Example #1
0
 /**
  * @param Event $event
  *
  * @throws MatchException
  */
 public function addEvent(Event $event)
 {
     $this->events[] = $event;
     if ($event->isGoal()) {
         if (null !== $this->teamHome && $event->getTeam()->equals($this->teamHome)) {
             $this->scoreHome++;
         } elseif (null !== $this->teamAway && $event->getTeam()->equals($this->teamAway)) {
             $this->scoreAway++;
         } else {
             throw new MatchException('team with id ' . $event->getTeam()->getId() . ' is not part of this match');
         }
     }
 }