code: protected function checkRatingValue($rating, $throwException = true)
      {
          if (!is_int($rating) || static::RATING_EXCELLENT < $rating || static::RATING_NONE > $rating) {
              if ($throwException) {
                  throw new \InvalidArgumentException(sprintf('%s is not a valid rating value.', $rating));
              }
              return false;
          }
          return true;
      }
docs: Checks if rating is a valid value.
  
  @param int $rating
  @param bool $throwException
  @throws \InvalidArgumentException
  @return bool