diff --git a/app/Infrastructure/Analyze/Adapters/AnalyzeServiceAdapter.php b/app/Infrastructure/Analyze/Adapters/AnalyzeServiceAdapter.php index a1764ad..8811511 100644 --- a/app/Infrastructure/Analyze/Adapters/AnalyzeServiceAdapter.php +++ b/app/Infrastructure/Analyze/Adapters/AnalyzeServiceAdapter.php @@ -9,13 +9,13 @@ use App\Domain\Aggregators\FileAggregator; use App\Domain\Aggregators\WordAggregator; use App\Infrastructure\Analyze\Visitors\ClassVisitor; -use App\Infrastructure\Analyze\Mappers\PhpParserWordMapper; +use App\Infrastructure\Analyze\Mappers\AnalyzeServiceMapper; class AnalyzeServiceAdapter implements AnalyzeService { public function __construct( private Parser $parser, - private PhpParserWordMapper $mapper, + private AnalyzeServiceMapper $mapper, ) {} public function getWords(FileAggregator $fileAggregator, bool $withMethod): WordAggregator diff --git a/app/Infrastructure/Analyze/Mappers/PhpParserWordMapper.php b/app/Infrastructure/Analyze/Mappers/AnalyzeServiceMapper.php similarity index 68% rename from app/Infrastructure/Analyze/Mappers/PhpParserWordMapper.php rename to app/Infrastructure/Analyze/Mappers/AnalyzeServiceMapper.php index 169b9d4..5b6941a 100644 --- a/app/Infrastructure/Analyze/Mappers/PhpParserWordMapper.php +++ b/app/Infrastructure/Analyze/Mappers/AnalyzeServiceMapper.php @@ -5,7 +5,7 @@ use App\Domain\Entities\WordEntity; use App\Domain\Aggregators\WordAggregator; -class PhpParserWordMapper +class AnalyzeServiceMapper { public function __construct( private WordAggregator $wordAggregator, @@ -15,9 +15,7 @@ public function __construct( public function map(array $words): void { foreach ($words as $word) { - $this->wordAggregator->add( - WordEntity::from($word), - ); + $this->add($word); } } @@ -25,4 +23,11 @@ public function aggregate(): WordAggregator { return $this->wordAggregator; } + + private function add(string $word): void + { + $this->wordAggregator->add( + WordEntity::from($word), + ); + } }