Add dictionary link
This commit is contained in:
parent
961c060309
commit
10ec71b76a
1 changed files with 3 additions and 1 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue