public function add_single(Hour $hour) { $hours = count($this->hours); if($hours && $hour->getHour() < $this->hours[$hours-1]->getHour()) { $this->past_midnight = True; } if($this->past_midnight) { $hour->pastMidnight(); } $this->hours[] = $hour; }