/** * @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; }