diff --git a/src/Matcher.php b/src/Matcher.php index ac63b62..0d53745 100644 --- a/src/Matcher.php +++ b/src/Matcher.php @@ -7,6 +7,8 @@ use Illuminate\Support\LazyCollection; class Matcher { + private const DICTIONARY = __DIR__ . '/../assets/words.txt'; + public static function findWords(string $anagram, int $minLength = 3): Collection { $matches = self::getWordList() @@ -38,7 +40,7 @@ class Matcher private static function getWordList(): LazyCollection { return LazyCollection::make(function () { - $fh = fopen(DICTIONARY, 'rb'); + $fh = fopen(self::DICTIONARY, 'rb'); try { while (($line = fgets($fh)) !== false) { yield rtrim($line, "\r\n");