コード例 #1
0
ファイル: Factory.php プロジェクト: 0ida/fussi
 /**
  * @param AbstractTournament $tournament
  * @param PlannedMatch       $plannedMatch
  *
  * @return MatchForm
  */
 public function getMatchForm(AbstractTournament $tournament, PlannedMatch $plannedMatch = null)
 {
     $gamesPerMatch = $tournament->getMinimumNumberOfGames();
     if ($tournament->getTeamType() == $tournament::TYPE_SINGLE) {
         $form = new MatchFormSingle($this->playerRepository, $gamesPerMatch, $tournament->getMaxScore());
     } else {
         if ($plannedMatch == null) {
             $form = new MatchFormDouble($this->playerRepository, $gamesPerMatch, $tournament->getMaxScore(), $tournament->getPlayers());
         } else {
             $form = new MatchFormDouble($this->playerRepository, $gamesPerMatch, $tournament->getMaxScore(), array());
             $form->setTeamOne($plannedMatch->getTeam1());
             $form->setTeamTwo($plannedMatch->getTeam2());
         }
     }
     return $form;
 }
コード例 #2
0
ファイル: Tournament.php プロジェクト: 0ida/fussi
 /**
  * @param PlannedMatch $plannedMatch
  * @param Match  $match
  */
 public function matchPlayed(Match $match, PlannedMatch $plannedMatch = null)
 {
     $plannedMatch->matchPlayed($match);
     $winner = $plannedMatch->getTeam($match->getWinner() - 1);
     if ($plannedMatch->isFinal()) {
         $this->winner = $winner;
         $second = $plannedMatch->getTeam($match->getLooser() - 1);
         $this->second = $second;
         $this->end = new \DateTime();
     } else {
         $plannedMatch->getMatchForWinner()->setTeam($winner, $plannedMatch->getMatchIndexForWinner());
     }
 }
コード例 #3
0
ファイル: PlannedMatchTest.php プロジェクト: 0ida/fussi
 public function testIsNotFinal()
 {
     $match = $this->getMock('Application\\Model\\Entity\\PlannedMatch');
     $this->plannedMatch->winnerPlaysInMatchAt($match, 1);
     $this->assertFalse($this->plannedMatch->isFinal());
 }