Exemplo n.º 1
0
 /**
  * @param Pause $pause
  * @return bool
  */
 public function isOverlapping(Pause $pause)
 {
     if ($this->getEnd() <= $pause->getStart()) {
         return false;
     }
     if ($this->getStart() >= $pause->getEnd()) {
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * @param Pause $pause
  */
 private function addPause(Pause $pause)
 {
     if ($pause->getStart() < $this->getArrival()) {
         throw new \InvalidArgumentException();
     }
     if ($pause->getEnd() > $this->getDeparture()) {
         throw new \InvalidArgumentException();
     }
     if ($this->isPauseOverlapping($pause)) {
         throw new \InvalidArgumentException();
     }
     $this->pauseList[] = $pause;
 }