@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | protected function setWordsCollection(Collection $wordsCollection): self |
19 | 19 | { |
20 | 20 | $this->wordsCollection = $wordsCollection->filter( |
21 | - fn ($word) => Str::length($word) >= $this->minWordLen && Str::length($word) <= $this->maxWordLen |
|
21 | + fn($word) => Str::length($word) >= $this->minWordLen && Str::length($word) <= $this->maxWordLen |
|
22 | 22 | ) |
23 | 23 | ->map(fn($word) => Str::upper($word)); |
24 | 24 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $len = rand($this->minWordLen, $this->gridSize); |
36 | 36 | } while (in_array($len, $exclude)); |
37 | 37 | |
38 | - $available = $this->wordsCollection->filter(fn ($word) => Str::length($word) === $len)->count(); |
|
38 | + $available = $this->wordsCollection->filter(fn($word) => Str::length($word) === $len)->count(); |
|
39 | 39 | |
40 | 40 | $exclude[] = $len; |
41 | 41 | |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | |
45 | 45 | protected function markWordUsed($word): void |
46 | 46 | { |
47 | - $this->wordsCollection = $this->wordsCollection->reject(function ($current) use ($word) { |
|
47 | + $this->wordsCollection = $this->wordsCollection->reject(function($current) use ($word) { |
|
48 | 48 | return $current === $word; |
49 | 49 | }); |
50 | 50 | } |
51 | 51 | |
52 | 52 | protected function getRandomWord(int $len): string |
53 | 53 | { |
54 | - $word = $this->wordsCollection->filter(function ($word) use ($len) { |
|
54 | + $word = $this->wordsCollection->filter(function($word) use ($len) { |
|
55 | 55 | return Str::length($word) === $len; |
56 | 56 | })->random(1)->first(); |
57 | 57 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | protected function getWordLike(string $pattern): ?string |
64 | 64 | { |
65 | 65 | $pattern = str_replace("_", ".", $pattern); |
66 | - $words = $this->wordsCollection->filter(function ($word) use ($pattern) { |
|
66 | + $words = $this->wordsCollection->filter(function($word) use ($pattern) { |
|
67 | 67 | return preg_match("/^$pattern\$/i", $word); |
68 | 68 | }); |
69 | 69 |