getBegin()->getTimestamp(); $seconds = $minutes * 60; $diff = $timestamp % $seconds; if (0 === $diff) { return; } $newBegin = clone $record->getBegin(); $newBegin->setTimestamp($timestamp - $diff); $record->setBegin($newBegin); } /** * @param Timesheet $record * @param int $minutes */ public function roundEnd(Timesheet $record, $minutes) { if ($minutes <= 0) { return; } $timestamp = $record->getEnd()->getTimestamp(); $seconds = $minutes * 60; $diff = $timestamp % $seconds; if (0 === $diff) { return; } $newEnd = clone $record->getEnd(); $newEnd->setTimestamp($timestamp - $diff); $record->setEnd($newEnd); } /** * @param Timesheet $record * @param int $minutes */ public function roundDuration(Timesheet $record, $minutes) { if ($minutes <= 0) { return; } $timestamp = $record->getDuration(); $seconds = $minutes * 60; $diff = $timestamp % $seconds; if (0 === $diff) { return; } $record->setDuration($timestamp - $diff); } }