B
B
BonBon Slick2018-05-02 22:08:51
Software design
BonBon Slick, 2018-05-02 22:08:51

Create new ValueObject when comparing or use int values?

Some function that compares values.

public function equalToRatingOrHigher(int $rating) : bool
    {
        return $this->rating >= $rating;
    }

// или так правильно

  public function equalToRatingOrHigher(UserRating $rating) : bool
    {
        return $this->rating >= $rating->rating();
    }

Can you please tell me which form is correct and why?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question