@@ -43,11 +43,11 @@ |
||
43 | 43 | |
44 | 44 | private $groups = []; |
45 | 45 | |
46 | - function __construct(string $what = 'points', string $how = '>', $val = 0, $groups = []){ |
|
46 | + function __construct(string $what = 'points', string $how = '>', $val = 0, $groups = []) { |
|
47 | 47 | if (in_array(strtolower($what), ['points', 'score', 'wins', 'draws', 'losses', 'second', 'third', 'team', 'notprogressed', 'progressed'])) $this->what = strtolower($what); |
48 | 48 | if (in_array($how, ['>', '<', '>=', '<=', '=', '!='])) $this->how = $how; |
49 | 49 | if ((gettype($val) === 'integer' && strtolower($what) !== 'team') || ($val instanceof Team && strtolower($what) === 'team')) $this->val = $val; |
50 | - $this->groups = array_map(function($a) { return $a->getId(); }, array_filter($groups, function($a) {return ($a instanceof Group);})); |
|
50 | + $this->groups = array_map(function($a) { return $a->getId(); }, array_filter($groups, function($a) {return ($a instanceof Group); })); |
|
51 | 51 | } |
52 | 52 | public function __toString() { |
53 | 53 | return 'Filter: '.$this->what.' '.($this->what !== 'notprogressed' && $this->what !== 'progressed' ? $this->how.' '.$this->val : ''); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | return $this->id; |
41 | 41 | } |
42 | 42 | |
43 | - public function addGroup(Group ...$groups){ |
|
43 | + public function addGroup(Group ...$groups) { |
|
44 | 44 | foreach ($groups as $group) { |
45 | 45 | $this->groups[] = $group; |
46 | 46 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->groups[] = $g->setSkip($this->allowSkip); |
52 | 52 | return $g; |
53 | 53 | } |
54 | - public function getGroups(){ |
|
54 | + public function getGroups() { |
|
55 | 55 | $this->orderGroups(); |
56 | 56 | return $this->groups; |
57 | 57 | } |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | return array_map(function($a) { return $a->getId(); }, $this->groups); |
61 | 61 | } |
62 | 62 | public function orderGroups() { |
63 | - usort($this->groups, function($a, $b){ |
|
64 | - return $a->getOrder() - $b->getOrder(); |
|
63 | + usort($this->groups, function($a, $b) { |
|
64 | + return $a->getOrder()-$b->getOrder(); |
|
65 | 65 | }); |
66 | 66 | return $this->groups; |
67 | 67 | } |
68 | 68 | |
69 | - public function allowSkip(){ |
|
69 | + public function allowSkip() { |
|
70 | 70 | $this->allowSkip = true; |
71 | 71 | return $this; |
72 | 72 | } |
73 | - public function disallowSkip(){ |
|
73 | + public function disallowSkip() { |
|
74 | 74 | $this->allowSkip = false; |
75 | 75 | return $this; |
76 | 76 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return $this->allowSkip; |
83 | 83 | } |
84 | 84 | |
85 | - public function genGames(){ |
|
85 | + public function genGames() { |
|
86 | 86 | foreach ($this->groups as $group) { |
87 | 87 | $group->genGames(); |
88 | 88 | $this->games = array_merge($this->games, $group->orderGames()); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public function getGames() { |
93 | 93 | return $this->games; |
94 | 94 | } |
95 | - public function isPlayed(){ |
|
95 | + public function isPlayed() { |
|
96 | 96 | if (count($this->games) === 0) return false; |
97 | 97 | foreach ($this->groups as $group) { |
98 | 98 | if (!$group->isPlayed()) return false; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return $this; |
155 | 155 | } |
156 | 156 | |
157 | - public function progress(bool $blank = false){ |
|
157 | + public function progress(bool $blank = false) { |
|
158 | 158 | foreach ($this->groups as $group) { |
159 | 159 | $group->progress($blank); |
160 | 160 | } |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | return $this->id; |
51 | 51 | } |
52 | 52 | |
53 | - public function allowSkip(){ |
|
53 | + public function allowSkip() { |
|
54 | 54 | $this->generator->allowSkip(); |
55 | 55 | return $this; |
56 | 56 | } |
57 | - public function disallowSkip(){ |
|
57 | + public function disallowSkip() { |
|
58 | 58 | $this->generator->disallowSkip(); |
59 | 59 | return $this; |
60 | 60 | } |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | $this->games[] = $g; |
189 | 189 | return $g; |
190 | 190 | } |
191 | - public function addGame(...$games){ |
|
191 | + public function addGame(...$games) { |
|
192 | 192 | foreach ($games as $key => $game) { |
193 | 193 | if (gettype($game) === 'array') { |
194 | 194 | unset($games[$key]); |
195 | - $this->games = array_merge($this->games, array_filter($game, function($a){ return ($a instanceof Game); })); |
|
195 | + $this->games = array_merge($this->games, array_filter($game, function($a) { return ($a instanceof Game); })); |
|
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | if (!$game instanceof Game) throw new \Exception('Trying to add game which is not instance of Game object.'); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | return $this; |
220 | 220 | } |
221 | - public function isPlayed(){ |
|
221 | + public function isPlayed() { |
|
222 | 222 | if (count($this->games) === 0) return false; |
223 | 223 | foreach ($this->games as $game) { |
224 | 224 | if (!$game->isPlayed()) return false; |
@@ -66,11 +66,11 @@ |
||
66 | 66 | if (count($error) > 0) throw new \Exception('Trying to add teams ('.count($error).') that are not instance of Team class'.PHP_EOL.print_r($error, true)); |
67 | 67 | return $this; |
68 | 68 | } |
69 | - public function getTeams(){ |
|
69 | + public function getTeams() { |
|
70 | 70 | return $this->teams; |
71 | 71 | } |
72 | - public function getTeamsIds(){ |
|
73 | - return array_map(function($a){ return $a->getId(); }, $this->teams); |
|
72 | + public function getTeamsIds() { |
|
73 | + return array_map(function($a) { return $a->getId(); }, $this->teams); |
|
74 | 74 | } |
75 | 75 | public function getTeam(string $id) { |
76 | 76 | foreach ($this->teams as $team) { |