src/ShopRatingServiceBundle/objects/ShopauskunftXmlStreamer.class.php
protected function getCriterionsAverageScore(\SimpleXMLElement $rating)
    {
        $criterions = array('criterion1', 'criterion2', 'criterion3', 'criterion4', 'criterion5', 'criterion6');
        $sum = 0;
        $divider = 0;
        foreach ($criterions as $criterion) {
            $criterionValue = (float) $rating->$criterion;
            if ($criterionValue > 0) {
                ++$divider;
                $sum += $criterionValue;
            }
        }
        $divider = (0 == $divider) ? count($criterions) : $divider;

        return $sum / $divider;
    }
protected function getCriterionsAverageScore(\SimpleXMLElement $rating)
    {
        $criterions = array('criterion1', 'criterion2', 'criterion3', 'criterion4', 'criterion5', 'criterion6');
        $sum = 0;
        $divider = 0;
        foreach ($criterions as $criterion) {
            $criterionValue = (float) $rating->$criterion;
            if ($criterionValue > 0) {
                ++$divider;
                $sum += $criterionValue;
            }
        }
        $divider = (0 == $divider) ? count($criterions) : $divider;

        return $sum / $divider;
    }
protected function getCriterionsAverageScore ( \ SimpleXMLElement $ rating ) { $ criterions = array ( 'criterion1' , 'criterion2' , 'criterion3' , 'criterion4' , 'criterion5' , 'criterion6' ) ; $ sum = 0 ; $ divider = 0 ; foreach ( $ criterions as $ criterion ) { $ criterionValue = ( float ) $ rating -> $ criterion ; if ( $ criterionValue > 0 ) { ++ $ divider ; $ sum += $ criterionValue ; } } $ divider = ( 0 == $ divider ) ? count ( $ criterions ) : $ divider ; return $ sum / $ divider ; }
Calculates the average score over all criterions.

@param SimpleXMLElement $rating The rating

@return float The average score
Calculates the average score over all criterions .