src/Entity/AbstractRatingEntity.php
public function getAverage($includeNoneRating = false, $recalculate = false)
    {
        if ($this->_average && !$recalculate) {
            return $this->_average;
        }
        
        $sum   = 0;
        $count = 0;
        foreach (get_class_methods($this) as $method) {
            if ('getAverage' == $method || 0 !== strpos($method, 'get')) {
                continue;
            }
            
            $rating = $this->$method();
            if (!$this->checkRatingValue($rating, /*throwException*/ false)
                || (!$includeNoneRating && $rating == static::RATING_NONE)) {
                continue;
            }
            
            $sum   += $rating;
            $count += 1;
        }
        
        $average = 0 == $count ? 0 : round($sum / $count);
        $this->_average = $average;
        
        return $average;
    }
public function getAverage($includeNoneRating = false, $recalculate = false)
    {
        if ($this->_average && !$recalculate) {
            return $this->_average;
        }
        
        $sum   = 0;
        $count = 0;
        foreach (get_class_methods($this) as $method) {
            if ('getAverage' == $method || 0 !== strpos($method, 'get')) {
                continue;
            }
            
            $rating = $this->$method();
            if (!$this->checkRatingValue($rating, /*throwException*/ false)
                || (!$includeNoneRating && $rating == static::RATING_NONE)) {
                continue;
            }
            
            $sum   += $rating;
            $count += 1;
        }
        
        $average = 0 == $count ? 0 : round($sum / $count);
        $this->_average = $average;
        
        return $average;
    }
{@inheritDoc}
@see \Core\Entity\RatingInterface::getAverage()