From aad21eaa299adcecea8d9013e56d9ccb2e9f9594 Mon Sep 17 00:00:00 2001 From: DeGraciaMathieu Date: Mon, 9 Dec 2024 09:28:38 +0100 Subject: [PATCH] renamed hasDependency method --- app/Domain/Aggregators/DependencyAggregator.php | 2 +- app/Domain/Entities/ClassDependencies.php | 2 +- tests/Unit/Domain/Entities/ClassDependenciesTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Domain/Aggregators/DependencyAggregator.php b/app/Domain/Aggregators/DependencyAggregator.php index 0e688e7..d42e7b6 100644 --- a/app/Domain/Aggregators/DependencyAggregator.php +++ b/app/Domain/Aggregators/DependencyAggregator.php @@ -44,7 +44,7 @@ public function calculateInstability(): void continue; } - if ($otherClass->hasDependency($givenClass)) { + if ($otherClass->isDependentOn($givenClass)) { $givenClass->incrementAfferent(); } } diff --git a/app/Domain/Entities/ClassDependencies.php b/app/Domain/Entities/ClassDependencies.php index 0d9d6ab..a2f0712 100644 --- a/app/Domain/Entities/ClassDependencies.php +++ b/app/Domain/Entities/ClassDependencies.php @@ -48,7 +48,7 @@ public function incrementAfferent(): void $this->coupling->incrementAfferent(); } - public function hasDependency(ClassDependencies $otherClass): bool + public function isDependentOn(ClassDependencies $otherClass): bool { return $this->dependencies->knows($otherClass->fqcn); } diff --git a/tests/Unit/Domain/Entities/ClassDependenciesTest.php b/tests/Unit/Domain/Entities/ClassDependenciesTest.php index d027a09..f052635 100644 --- a/tests/Unit/Domain/Entities/ClassDependenciesTest.php +++ b/tests/Unit/Domain/Entities/ClassDependenciesTest.php @@ -43,7 +43,7 @@ ->withFqcn('C') ->build(); - expect($classDependencies->hasDependency($c))->toBeFalse(); + expect($classDependencies->isDependentOn($c))->toBeFalse(); }); test('it correctly checks if a class is a dependency', function () { @@ -59,7 +59,7 @@ ->withFqcn('B') ->build(); - expect($classDependencies->hasDependency($b))->toBeTrue(); + expect($classDependencies->isDependentOn($b))->toBeTrue(); }); test('it calculates the abstractness correctly', function () {