@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | if ($a->groupResults[$group->id]["points"] === $b->groupResults[$group->id]["points"]) return ($a->groupResults[$group->id]["score"] > $b->groupResults[$group->id]["score"] ? -1 : 1); |
| 19 | 19 | return ($a->groupResults[$group->id]["points"] > $b->groupResults[$group->id]["points"] ? -1 : 1); |
| 20 | 20 | }); |
| 21 | - break;} |
|
| 21 | + break; } |
|
| 22 | 22 | case \SCORE:{ |
| 23 | 23 | uasort($teams, function($a, $b) use ($group) { |
| 24 | 24 | if ($a->groupResults[$group->id]["score"] === $b->groupResults[$group->id]["score"]) return 0; |
| 25 | 25 | return ($a->groupResults[$group->id]["score"] > $b->groupResults[$group->id]["score"] ? -1 : 1); |
| 26 | 26 | }); |
| 27 | - break;} |
|
| 27 | + break; } |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | return $teams; |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | if ($a->sumPoints($groupsIds) === $b->sumPoints($groupsIds)) return ($a->sumScore($groupsIds) > $b->sumScore($groupsIds) ? -1 : 1); |
| 42 | 42 | return ($a->sumPoints($groupsIds) > $b->sumPoints($groupsIds) ? -1 : 1); |
| 43 | 43 | }); |
| 44 | - break;} |
|
| 44 | + break; } |
|
| 45 | 45 | case \SCORE:{ |
| 46 | 46 | uasort($teams, function($a, $b) use ($groupsIds) { |
| 47 | 47 | if ($a->sumScore($groupsIds) === $b->sumScore($groupsIds)) return 0; |
| 48 | 48 | return ($a->sumScore($groupsIds) > $b->sumScore($groupsIds) ? -1 : 1); |
| 49 | 49 | }); |
| 50 | - break;} |
|
| 50 | + break; } |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | return $teams; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | return $this->name; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function addGroup(Group ...$groups){ |
|
| 26 | + public function addGroup(Group ...$groups) { |
|
| 27 | 27 | foreach ($groups as $group) { |
| 28 | 28 | if ($group instanceof Group) $this->groups[] = $group; |
| 29 | 29 | else throw new \Exception('Trying to add group which is not an instance of Group class.'); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->groups[] = $g->setSkip($this->allowSkip); |
| 36 | 36 | return $g; |
| 37 | 37 | } |
| 38 | - public function getGroups(){ |
|
| 38 | + public function getGroups() { |
|
| 39 | 39 | $this->orderGroups(); |
| 40 | 40 | return $this->groups; |
| 41 | 41 | } |
@@ -44,16 +44,16 @@ discard block |
||
| 44 | 44 | return array_map(function($a) { return $a->id; }, $this->groups); |
| 45 | 45 | } |
| 46 | 46 | public function orderGroups() { |
| 47 | - usort($this->groups, function($a, $b){ |
|
| 48 | - return $a->order - $b->order; |
|
| 47 | + usort($this->groups, function($a, $b) { |
|
| 48 | + return $a->order-$b->order; |
|
| 49 | 49 | }); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function allowSkip(){ |
|
| 52 | + public function allowSkip() { |
|
| 53 | 53 | $this->allowSkip = true; |
| 54 | 54 | return $this; |
| 55 | 55 | } |
| 56 | - public function disallowSkip(){ |
|
| 56 | + public function disallowSkip() { |
|
| 57 | 57 | $this->allowSkip = false; |
| 58 | 58 | return $this; |
| 59 | 59 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return $this->allowSkip; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function genGames(){ |
|
| 68 | + public function genGames() { |
|
| 69 | 69 | foreach ($this->groups as $group) { |
| 70 | 70 | $group->genGames(); |
| 71 | 71 | $this->games = array_merge($this->games, $group->orderGames()); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function getGames() { |
| 76 | 76 | return $this->games; |
| 77 | 77 | } |
| 78 | - public function isPlayed(){ |
|
| 78 | + public function isPlayed() { |
|
| 79 | 79 | foreach ($this->groups as $group) { |
| 80 | 80 | if (!$group->isPlayed()) return false; |
| 81 | 81 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function addTeam(...$teams) { |
| 86 | 86 | foreach ($teams as $team) { |
| 87 | - if ($team instanceof Team) { |
|
| 87 | + if ($team instanceof Team) { |
|
| 88 | 88 | $this->teams[] = $team; |
| 89 | 89 | } |
| 90 | 90 | elseif (gettype($team) === 'array') { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - public function progress(bool $blank = false){ |
|
| 156 | + public function progress(bool $blank = false) { |
|
| 157 | 157 | foreach ($this->groups as $group) { |
| 158 | 158 | $group->progress($blank); |
| 159 | 159 | } |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | return 'Group '.$this->name; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function allowSkip(){ |
|
| 60 | + public function allowSkip() { |
|
| 61 | 61 | $this->generator->allowSkip(); |
| 62 | 62 | return $this; |
| 63 | 63 | } |
| 64 | - public function disallowSkip(){ |
|
| 64 | + public function disallowSkip() { |
|
| 65 | 65 | $this->generator->disallowSkip(); |
| 66 | 66 | return $this; |
| 67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | public function addTeam(...$teams) { |
| 77 | 77 | foreach ($teams as $team) { |
| 78 | - if ($team instanceof Team) { |
|
| 78 | + if ($team instanceof Team) { |
|
| 79 | 79 | $this->teams[] = $team; |
| 80 | 80 | $team->groupResults[$this->id] = [ |
| 81 | 81 | 'group' => $this, |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $this->games[] = $g; |
| 219 | 219 | return $g; |
| 220 | 220 | } |
| 221 | - public function addGame(...$games){ |
|
| 221 | + public function addGame(...$games) { |
|
| 222 | 222 | foreach ($games as $key => $game) { |
| 223 | 223 | if (gettype($game) === 'array') { |
| 224 | 224 | unset($games[$key]); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | return $this; |
| 264 | 264 | } |
| 265 | - public function isPlayed(){ |
|
| 265 | + public function isPlayed() { |
|
| 266 | 266 | foreach ($this->games as $game) { |
| 267 | 267 | if ((isset($game) || !$this->getSkip()) && !$game->isPlayed()) return false; |
| 268 | 268 | } |