fix namespacing
This commit is contained in:
parent
699279888a
commit
bdf707c296
5 changed files with 10 additions and 25 deletions
|
|
@ -3,8 +3,8 @@
|
||||||
require __DIR__ . '/../autoload.php';
|
require __DIR__ . '/../autoload.php';
|
||||||
|
|
||||||
use Lvl0\AnagramFinder\Core\Matcher;
|
use Lvl0\AnagramFinder\Core\Matcher;
|
||||||
use Myrmidex\AnagramFinder\ArgHandler;
|
use Lvl0\AnagramFinder\TUI\ArgHandler;
|
||||||
use Myrmidex\AnagramFinder\Output;
|
use Lvl0\AnagramFinder\TUI\Output;
|
||||||
|
|
||||||
const DICTIONARY = __DIR__ . '/../assets/words.txt';
|
const DICTIONARY = __DIR__ . '/../assets/words.txt';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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);
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Myrmidex\\AnagramFinder\\": "src/",
|
"Lvl0\\AnagramFinder\\TUI\\": "src/",
|
||||||
"Myrmidex\\AnagramFinder\\Tests\\": "tests/"
|
"Lvl0\\AnagramFinder\\TUI\\Tests\\": "tests/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Myrmidex\AnagramFinder;
|
namespace Lvl0\AnagramFinder\TUI;
|
||||||
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
|
@ -21,13 +21,14 @@ class ArgHandler
|
||||||
public function get(int $index)
|
public function get(int $index)
|
||||||
{
|
{
|
||||||
return $this->args
|
return $this->args
|
||||||
->reject(fn ($word) => substr($word, 0, 2) === '--')
|
->reject(fn($word) => substr($word, 0, 2) === '--')
|
||||||
->get($index);
|
->get($index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasOption(string $option) {
|
public function hasOption(string $option)
|
||||||
|
{
|
||||||
return $this->args
|
return $this->args
|
||||||
->filter(fn ($word) => $word === '--' . $option)
|
->filter(fn($word) => $word === '--' . $option)
|
||||||
->isNotEmpty();
|
->isNotEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Myrmidex\AnagramFinder;
|
namespace Lvl0\AnagramFinder\TUI;
|
||||||
|
|
||||||
class Output
|
class Output
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue