/**
  * {@inheritdoc}
  */
 public function add(EventInterface $newEvent, array $events)
 {
     foreach ($events as $event) {
         if ($newEvent->getInterval()->isDuring($event->getInterval())) {
             throw CalendarEventException::eventOverlap($newEvent);
         }
     }
     return parent::add($newEvent, $events);
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function remove(EventInterface $removedEvent, array $events)
 {
     $index = 0;
     foreach ($events as $event) {
         if ($removedEvent->isEquals($event)) {
             array_splice($events, $index, 1);
         } else {
             $index++;
         }
     }
     return $events;
 }
Exemple #3
0
 public function isEquals(EventInterface $event)
 {
     return $this->interval->getBegin()->isEquals($event->getInterval()->getBegin()) && $this->interval->getEnd()->isEquals($event->getInterval()->getEnd());
 }