1 | <?php |
||
11 | class SecretSanta |
||
12 | { |
||
13 | /** @var PlayersCollection */ |
||
14 | private $players; |
||
15 | /** @var array */ |
||
16 | private $combination; |
||
17 | |||
18 | /** |
||
19 | * SecretSanta constructor. |
||
20 | */ |
||
21 | 12 | public function __construct() |
|
25 | |||
26 | /** |
||
27 | * @param string $name |
||
28 | * @param string $email |
||
29 | * @return SecretSanta |
||
30 | */ |
||
31 | 5 | public function addPlayer($name, $email) |
|
37 | |||
38 | /** |
||
39 | * @param string $name |
||
40 | * @param string $email |
||
41 | * @param string $coupleName |
||
42 | * @param string $coupleEmail |
||
43 | * @return SecretSanta |
||
44 | */ |
||
45 | 11 | public function addCouple($name, $email, $coupleName, $coupleEmail) |
|
54 | |||
55 | /** |
||
56 | * @return Player[] |
||
57 | * @throws SecretSantaException |
||
58 | */ |
||
59 | 9 | public function play() |
|
71 | |||
72 | /** |
||
73 | * @throws SecretSantaException |
||
74 | */ |
||
75 | 9 | private function combinePlayers() |
|
91 | |||
92 | /** |
||
93 | * @return bool |
||
94 | */ |
||
95 | 8 | private function tryMatchSecretSantaPlayers() |
|
111 | |||
112 | /** |
||
113 | * @param Player $player |
||
114 | * @param Player $secretPlayer |
||
115 | * @return bool |
||
116 | */ |
||
117 | 8 | private function isValidSecretSanta($player, $secretPlayer) |
|
127 | |||
128 | /** |
||
129 | * @return bool |
||
130 | */ |
||
131 | 8 | private function isValidCombination() |
|
135 | |||
136 | 8 | private function associatePlayers() |
|
146 | } |
||
147 |