CodeExplorer setAverage example
$points = 0;
$total = 0;
foreach ($data as $row) { $points +=
$row['points'
] *
$row['total'
];
$total +=
$row['total'
];
} $this->
sortByPointsDescending($data);
$struct->
setAverage($points /
$total * 2
);
$struct->
setCount($total);
$struct->
setPointCount($data);
return $struct;
} /**
* @return Vote
*/
public function hydrate(array
$data) {