public function getBestReadingByMethods($side, $methods)
{
$best = null;
foreach ($methods as $method) {
foreach ($this->{$side . '_readings'} as $reading) {
if ($reading->method->id == $method->id) {
if (!$best || $reading->value >= $best->value) {
$best = $reading;
}
}
}
}
if ($best) {
return $best->convertTo($best->value);
}
return $best;
}