Example #1
0
 public function getCountShotsOf(Player $player)
 {
     if ($player == $this->leg->getGame()->getPlayer1()) {
         return $this->leg->getPlayer1shots();
     } elseif ($player == $this->leg->getGame()->getPlayer2()) {
         return $this->leg->getPlayer2shots();
     } else {
         return 0;
     }
 }
Example #2
0
 /**
  * @inheritDoc
  */
 protected function handleLegCompleted(Leg $leg)
 {
     // check if this completes the game
     //        $game = $this->getGame(); -> does not yet know that leg is closed
     $game = $leg->getGame();
     $game->updateWonLegs();
     $winner = $this->checkForWinner($game);
     if (null !== $winner) {
         $game->setWinner($winner);
         $this->setGameCompleted($game);
     }
 }
Example #3
0
 public function __construct(Leg $leg, Player $player)
 {
     $this->leg = $leg;
     $this->player = $player;
     $this->created = new \DateTime();
     $leg->addTurn($this);
 }