Add dictionary link

This commit is contained in:
myrmidex 2026-08-22 18:36:47 +02:00
parent 961c060309
commit 10ec71b76a

View file

@ -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");