@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** @return MatchProposal[] */ |
| 30 | - public function for(AccountId $player, DateTimeInterface $currently = null): array |
|
| 30 | + public function for (AccountId $player, DateTimeInterface $currently = null): array |
|
| 31 | 31 | { |
| 32 | 32 | $currently = $currently ?: $this->clock->now(); |
| 33 | 33 | $proposals = []; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | // @todo filter by date |
| 55 | 55 | return array_values(array_filter( |
| 56 | 56 | $this->proposals, |
| 57 | - static function (MatchProposal $proposal): bool { |
|
| 57 | + static function(MatchProposal $proposal): bool { |
|
| 58 | 58 | return $proposal->hasBeenAccepted(); |
| 59 | 59 | } |
| 60 | 60 | )); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | ): array { |
| 79 | 79 | return array_filter( |
| 80 | 80 | $this->acceptedSince($since), |
| 81 | - static function (MatchProposal $proposal) use ($account): bool { |
|
| 81 | + static function(MatchProposal $proposal) use ($account): bool { |
|
| 82 | 82 | return $proposal->wasProposedBy($account); |
| 83 | 83 | } |
| 84 | 84 | ); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | ): array { |
| 92 | 92 | return array_filter( |
| 93 | 93 | $this->acceptedSince($since), |
| 94 | - static function (MatchProposal $proposal) use ($account): bool { |
|
| 94 | + static function(MatchProposal $proposal) use ($account): bool { |
|
| 95 | 95 | return $proposal->wasProposedTo($account); |
| 96 | 96 | } |
| 97 | 97 | ); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $this->cards[$owner] = array_filter( |
| 26 | 26 | $this->cards[$owner], |
| 27 | - static function (Card $card) use ($cardToRemove): bool { |
|
| 27 | + static function(Card $card) use ($cardToRemove): bool { |
|
| 28 | 28 | return $card->offset() !== $cardToRemove; |
| 29 | 29 | } |
| 30 | 30 | ); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | return array_filter( |
| 65 | 65 | $this->cardsInPlay(), |
| 66 | - static function (Card $card): bool { |
|
| 66 | + static function(Card $card): bool { |
|
| 67 | 67 | return $card->isAttacking(); |
| 68 | 68 | } |
| 69 | 69 | ); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | return array_filter( |
| 76 | 76 | $this->cardsInPlay(), |
| 77 | - static function (Card $card): bool { |
|
| 77 | + static function(Card $card): bool { |
|
| 78 | 78 | return $card->isDefending(); |
| 79 | 79 | } |
| 80 | 80 | ); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | return current(array_filter( |
| 86 | 86 | $this->cardsInPlayFor($player), |
| 87 | - static function (Card $card) use ($offset): bool { |
|
| 87 | + static function(Card $card) use ($offset): bool { |
|
| 88 | 88 | return $card->offset() === $offset; |
| 89 | 89 | } |
| 90 | 90 | )); |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | { |
| 10 | 10 | private $battlefields = []; |
| 11 | 11 | |
| 12 | - public function for(MatchId $match): Battlefield |
|
| 12 | + public function for (MatchId $match): Battlefield |
|
| 13 | 13 | { |
| 14 | 14 | if (!array_key_exists($match->id(), $this->battlefields)) { |
| 15 | 15 | $this->battlefields[$match->id()] = Battlefield::untouched(); |
@@ -29,9 +29,9 @@ |
||
| 29 | 29 | array $parameters, |
| 30 | 30 | $absolute = false |
| 31 | 31 | ): string { |
| 32 | - return $this->prefix . str_replace( |
|
| 33 | - array_map(static function (string $parameter): string { |
|
| 34 | - return '{' . $parameter . '}'; |
|
| 32 | + return $this->prefix.str_replace( |
|
| 33 | + array_map(static function(string $parameter): string { |
|
| 34 | + return '{'.$parameter.'}'; |
|
| 35 | 35 | }, array_keys($parameters)), |
| 36 | 36 | array_values($parameters), |
| 37 | 37 | self::ROUTES[$name] |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function do(string $action, array $parameters = []): void |
|
| 21 | + public function do(string $action, array $parameters = []) : void |
|
| 22 | 22 | { |
| 23 | 23 | |
| 24 | 24 | } |
@@ -24,28 +24,28 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function inHand(): Cards |
| 26 | 26 | { |
| 27 | - return $this->filterBy(static function (Card $card): bool { |
|
| 27 | + return $this->filterBy(static function(Card $card): bool { |
|
| 28 | 28 | return $card->isInHand(); |
| 29 | 29 | }); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function inPlay(): Cards |
| 33 | 33 | { |
| 34 | - return $this->filterBy(static function (Card $card): bool { |
|
| 34 | + return $this->filterBy(static function(Card $card): bool { |
|
| 35 | 35 | return $card->isInPlay(); |
| 36 | 36 | }); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function thatAttack(): Cards |
| 40 | 40 | { |
| 41 | - return $this->filterBy(static function (Card $card): bool { |
|
| 41 | + return $this->filterBy(static function(Card $card): bool { |
|
| 42 | 42 | return $card->isAttacking(); |
| 43 | 43 | }); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function thatDefend(): Cards |
| 47 | 47 | { |
| 48 | - return $this->filterBy(static function (Card $card): bool { |
|
| 48 | + return $this->filterBy(static function(Card $card): bool { |
|
| 49 | 49 | return $card->isDefending(); |
| 50 | 50 | }); |
| 51 | 51 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function theOneThatAttacksTheAmbushOf(Card $defender): Card |
| 59 | 59 | { |
| 60 | - return $this->filterBy(static function (Card $card) use ($defender): bool { |
|
| 60 | + return $this->filterBy(static function(Card $card) use ($defender): bool { |
|
| 61 | 61 | return $card->isAttackingThe($defender); |
| 62 | 62 | })[0]; |
| 63 | 63 | } |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | private function topMostCardInDeck(): Card |
| 66 | 66 | { |
| 67 | 67 | $card = array_reduce( |
| 68 | - array_filter($this->items(), static function (Card $card): bool { |
|
| 68 | + array_filter($this->items(), static function(Card $card): bool { |
|
| 69 | 69 | return $card->isInDeck(); |
| 70 | 70 | }), |
| 71 | - static function (?Card $topmost, Card $card): ?Card { |
|
| 71 | + static function(?Card $topmost, Card $card): ?Card { |
|
| 72 | 72 | if ($topmost === null || $card->hasHigherPositionThan($topmost)) { |
| 73 | 73 | return $card; |
| 74 | 74 | } |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | MatchId $match |
| 43 | 43 | ): self { |
| 44 | 44 | return $shouldWeDefend ? |
| 45 | - self::defend($now, $match) : |
|
| 46 | - self::play($now, $match); |
|
| 45 | + self::defend($now, $match) : self::play($now, $match); |
|
| 47 | 46 | } |
| 48 | 47 | |
| 49 | 48 | public static function play(DateTimeInterface $now, MatchId $match): self |