Skip to content

Commit

Permalink
Add Todo for refactoring CompomentFilters and removal of reflection c…
Browse files Browse the repository at this point in the history
…lasses
  • Loading branch information
MarcelOxid committed Aug 19, 2024
1 parent 56ddf41 commit 2bca73e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Shared/DataType/ComponentFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/Shared/DataType/ComponentFiltersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2bca73e

Please sign in to comment.