示例#1
0
 public function testNotPlayedBy()
 {
     $player1 = new Player();
     $player2 = new Player();
     $player3 = new Player();
     $this->match->setPlayer1($player1);
     $this->match->setPlayer2($player2);
     $this->assertFalse($this->match->isPlayedBy($player1, $player3));
 }
示例#2
0
文件: PointLog.php 项目: 0ida/fussi
 /**
  * @return int
  */
 protected function getPointsParticipant2()
 {
     if ($this->match instanceof SingleMatch) {
         return $this->match->getPlayer2()->getPoints();
     } else {
         if ($this->match instanceof DoubleMatch) {
             return $this->getPointsForTeam($this->match->getTeamTwo());
         }
     }
 }
示例#3
0
 /**
  * Creates a new match
  *
  * @param AbstractTournament $tournament
  * @param Player             $player1
  * @param Player             $player2
  *
  * @return Match
  */
 public function getNew(AbstractTournament $tournament, $player1 = null, $player2 = null)
 {
     if ($tournament->getTeamType() == $tournament::TYPE_SINGLE) {
         $match = new SingleMatch();
         $match->setPlayer1($player1);
         $match->setPlayer2($player2);
     } else {
         $match = new DoubleMatch();
     }
     $gamesPerMatch = $tournament->getMinimumNumberOfGames();
     for ($i = 0; $i < $gamesPerMatch; $i++) {
         $match->addGame(new Game());
     }
     $match->setDate(new \DateTime());
     $match->setTournament($tournament);
     return $match;
 }