@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | protected function setWordsCollection(Collection $wordsCollection): self |
21 | 21 | { |
22 | 22 | $this->wordsCollection = $wordsCollection->filter( |
23 | - fn ($word) => Str::length($word) >= $this->minWordLen && Str::length($word) <= $this->maxWordLen |
|
23 | + fn($word) => Str::length($word) >= $this->minWordLen && Str::length($word) <= $this->maxWordLen |
|
24 | 24 | ) |
25 | 25 | ->map(fn($word) => Str::upper($word)); |
26 | 26 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $len = $this->wordLengths->keys()->random(); |
42 | 42 | } while (in_array($len, $exclude)); |
43 | 43 | |
44 | - $available = $this->wordsCollection->filter(fn ($word) => Str::length($word) === $len)->count(); |
|
44 | + $available = $this->wordsCollection->filter(fn($word) => Str::length($word) === $len)->count(); |
|
45 | 45 | |
46 | 46 | if ($available > 0) { |
47 | 47 | return $len; |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | |
55 | 55 | protected function markWordUsed($word): void |
56 | 56 | { |
57 | - $this->wordsCollection = $this->wordsCollection->reject(function ($current) use ($word) { |
|
57 | + $this->wordsCollection = $this->wordsCollection->reject(function($current) use ($word) { |
|
58 | 58 | return $current === $word; |
59 | 59 | }); |
60 | 60 | } |
61 | 61 | |
62 | 62 | protected function getRandomWord(int $len): string |
63 | 63 | { |
64 | - $word = $this->wordsCollection->filter(function ($word) use ($len) { |
|
64 | + $word = $this->wordsCollection->filter(function($word) use ($len) { |
|
65 | 65 | return Str::length($word) === $len; |
66 | 66 | })->random(1)->first(); |
67 | 67 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | protected function getWordLike(string $pattern): ?string |
74 | 74 | { |
75 | 75 | $pattern = str_replace("_", ".", $pattern); |
76 | - $words = $this->wordsCollection->filter(function ($word) use ($pattern) { |
|
76 | + $words = $this->wordsCollection->filter(function($word) use ($pattern) { |
|
77 | 77 | return preg_match("/^$pattern\$/i", $word); |
78 | 78 | }); |
79 | 79 |