From 2bca73e07113db8b7b4f8e20d16e6194485498a5 Mon Sep 17 00:00:00 2001 From: marcelmanzel Date: Mon, 19 Aug 2024 11:23:56 +0200 Subject: [PATCH] Add Todo for refactoring CompomentFilters and removal of reflection classes --- src/Shared/DataType/ComponentFilters.php | 12 ++++++++++++ tests/Unit/Shared/DataType/ComponentFiltersTest.php | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/Shared/DataType/ComponentFilters.php b/src/Shared/DataType/ComponentFilters.php index a084777..059396f 100644 --- a/src/Shared/DataType/ComponentFilters.php +++ b/src/Shared/DataType/ComponentFilters.php @@ -21,6 +21,12 @@ public function __construct( ) { } + /** + * TODO: This method can be refactored after the chain-of-responsibility-pattern + * Therefore classes like TitleFilter or ActiveFilter with the Component as argument can check if a specific + * property of the Component fits to a specific filter (String and BoolFilter). As a result we have an iterable list + * with filters which checks different fields. + */ private function filterComponentByTitle(string $title): bool { $titleFilter = $this->titleFilter; @@ -31,6 +37,12 @@ private function filterComponentByTitle(string $title): bool return true; } + /** + * TODO: This method can be refactored after the chain-of-responsibility-pattern + * Therefore classes like TitleFilter or ActiveFilter with the Component as argument can check if a specific + * property of the Component fits to a specific filter (String and BoolFilter). As a result we have an iterable list + * with filters which checks different fields. + */ private function filterComponentByStatus(bool $status): bool { $statusFilter = $this->activeFilter; diff --git a/tests/Unit/Shared/DataType/ComponentFiltersTest.php b/tests/Unit/Shared/DataType/ComponentFiltersTest.php index e7f21f8..35361a0 100644 --- a/tests/Unit/Shared/DataType/ComponentFiltersTest.php +++ b/tests/Unit/Shared/DataType/ComponentFiltersTest.php @@ -172,6 +172,10 @@ public function testCreateModuleFilterListWithNull(): void private static function getComponentFiltersMethod($name) { + /* + * TODO: This should be removed if ComponentFilters::filterComponentByTitle and filterComponentByStatus + * were refactored + */ $class = new ReflectionClass(ComponentFilters::class); $method = $class->getMethod($name); return $method;