CodeExplorer sortByPointsDescending example
$struct =
new VoteAverage();
$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
*/