Пример #1
0
 /**
  * @return Team[]
  */
 public function getStandings()
 {
     /** @var Team[] $teams */
     $teams = $this->teams->toArray();
     $points = array();
     $goalsDifference = array();
     $goalsFor = array();
     foreach ($teams as $k => $team) {
         $points[$k] = $team->getPoints();
         $goalsDifference[$k] = $team->getGoalsDifference();
         $goalsFor[$k] = $team->getGoalsFor();
     }
     array_multisort($points, SORT_DESC, $goalsDifference, SORT_DESC, $goalsFor, SORT_DESC, $teams);
     return $teams;
 }
Пример #2
0
 /**
  * @param Team $team
  */
 public function removeTeam(Team $team)
 {
     if (!$this->teams->contains($team)) {
         return;
     }
     $this->teams->removeElement($team);
     $team->removePlayer($this);
 }
Пример #3
0
 /**
  * @param Player $player
  */
 public function removePlayer(Player $player)
 {
     if (!$this->players->contains($player)) {
         return;
     }
     $this->players->removeElement($player);
     $player->removeTeam($this);
 }