@@ -73,6 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @param Player[] ...$players |
| 76 | + * @param Player $players |
|
| 76 | 77 | */ |
| 77 | 78 | private function excludePlayers(...$players) |
| 78 | 79 | { |
@@ -126,7 +127,7 @@ discard block |
||
| 126 | 127 | } |
| 127 | 128 | |
| 128 | 129 | /** |
| 129 | - * @param array $list |
|
| 130 | + * @param Player[] $list |
|
| 130 | 131 | * @return array |
| 131 | 132 | */ |
| 132 | 133 | private function shuffleAssoc($list) |
@@ -131,7 +131,9 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | private function shuffleAssoc($list) |
| 133 | 133 | { |
| 134 | - if (!is_array($list)) return $list; |
|
| 134 | + if (!is_array($list)) { |
|
| 135 | + return $list; |
|
| 136 | + } |
|
| 135 | 137 | |
| 136 | 138 | $keys = $this->forceShuffle(array_keys($list)); |
| 137 | 139 | $random = []; |
@@ -148,7 +150,9 @@ discard block |
||
| 148 | 150 | */ |
| 149 | 151 | private function forceShuffle($list) |
| 150 | 152 | { |
| 151 | - if (!is_array($list) || count($list) < 2) return $list; |
|
| 153 | + if (!is_array($list) || count($list) < 2) { |
|
| 154 | + return $list; |
|
| 155 | + } |
|
| 152 | 156 | |
| 153 | 157 | $shuffleList = $list; |
| 154 | 158 | while ($shuffleList == $list) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | throw new PlayersCollectionException('The couple can not be the same player'); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if (!$this->isDuplicatePlayer($player) && !$this->isDuplicatePlayer($couple) ) { |
|
| 40 | + if (!$this->isDuplicatePlayer($player) && !$this->isDuplicatePlayer($couple)) { |
|
| 41 | 41 | $this->players[$player->id()] = $player; |
| 42 | 42 | $this->players[$couple->id()] = $couple; |
| 43 | 43 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | foreach ($players as $mainPlayer) { |
| 85 | 85 | foreach ($players as $player) { |
| 86 | - if ($mainPlayer->id() == $player->id()){ |
|
| 86 | + if ($mainPlayer->id() == $player->id()) { |
|
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | 89 | $this->excludePlayers[$mainPlayer->id()][] = $player->id(); |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | |
| 81 | 81 | $retry = count($this->players) + $this->players->countExcludePlayers(); |
| 82 | 82 | |
| 83 | - while (!$this->tryMatchSecretSantaPlayers() && $retry > 0 ) { |
|
| 83 | + while (!$this->tryMatchSecretSantaPlayers() && $retry > 0) { |
|
| 84 | 84 | $retry--; |
| 85 | 85 | } |
| 86 | 86 | |