Clean up obsolete files

This commit is contained in:
myrmidex 2026-08-22 18:36:38 +02:00
parent 0df4e9e9d5
commit 961c060309
4 changed files with 0 additions and 87 deletions

View file

@ -1,26 +0,0 @@
<?php
require __DIR__ . '/../autoload.php';
use Myrmidex\AnagramFinder\ArgHandler;
use Myrmidex\AnagramFinder\Matcher;
use Myrmidex\AnagramFinder\Output;
const DICTIONARY = __DIR__ . '/../assets/words.txt';
Output::line("ANAGRAM FINDER");
$args = ArgHandler::make($argv);
$anagram = $args->get(1) ?: readline("Enter the anagram: ");
$minLength = $args->get(2) ?: 3;
$top10 = $args->hasOption('top');
Output::line();
Output::line("Results for your anagram: " . $anagram);
$matches = Matcher::findWords($anagram, $minLength);
if ($top10) {
$matches = $matches->slice(0, 10);
}
$matches->each(fn (string $word) => Output::line($word . " (" . strlen($word) . ")"));

View file

@ -1,16 +0,0 @@
<?php
require __DIR__ . '/../autoload.php';
use Myrmidex\AnagramFinder\Matcher;
// are letters in word?
$anagram = "eamstexil";
$word = "steam";
assert(Matcher::check(anagram: $anagram, word: $word) === true);
$anagram = "eamstexil";
$word = "xxx";
assert(Matcher::check(anagram: $anagram, word: $word) === false);

View file

@ -1,33 +0,0 @@
<?php
namespace Myrmidex\AnagramFinder;
use Illuminate\Support\Collection;
class ArgHandler
{
private Collection $args;
public function __construct(array $argv)
{
$this->args = new Collection($argv);
}
public static function make(array $argv): self
{
return new self($argv);
}
public function get(int $index)
{
return $this->args
->reject(fn ($word) => substr($word, 0, 2) === '--')
->get($index);
}
public function hasOption(string $option) {
return $this->args
->filter(fn ($word) => $word === '--' . $option)
->isNotEmpty();
}
}

View file

@ -1,12 +0,0 @@
<?php
namespace Myrmidex\AnagramFinder;
class Output
{
public static function line(string $message = ''): void
{
print($message . PHP_EOL);
flush();
}
}