/** * Set average and maximum heartrate from array */ private function setAvgAndMaxHeartrateFromArray() { $array = $this->TrainingObject->getArrayHeartrate(); if (!empty($array) && max($array) > 30) { $array = array_filter($array, 'ParserAbstract__ArrayFilterForLowEntries'); $this->TrainingObject->setPulseAvg(round(array_sum($array) / count($array))); $this->TrainingObject->setPulseMax(max($array)); } }
protected function checkArraySizes(\TrainingObject $object) { $arrays = array('elevation' => $object->getArrayAltitudeOriginal(), 'cadence' => $object->getArrayCadence(), 'distance' => $object->getArrayDistance(), 'heartrate' => $object->getArrayHeartrate(), 'latitude' => $object->getArrayLatitude(), 'longitude' => $object->getArrayLongitude(), 'time' => $object->getArrayTime()); $num = 0; $fails = false; $result = array(); foreach ($arrays as $key => $array) { $count = count($array); if ($count > 1) { if ($num == 0) { $num = $count; } elseif ($num != $count) { $fails = true; } $result[$key] = $count; } } $this->assertFalse($fails, print_r($result, true)); }