Total Complexity | 6 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
23 | class MembersBuilder |
||
24 | { |
||
25 | /** @var VisibilityFilter[] */ |
||
26 | protected $filters; |
||
27 | |||
28 | /** @param VisibilityFilter */ |
||
29 | 147 | public function __construct(array $filters = []) |
|
30 | { |
||
31 | 147 | $this->filters = $filters; |
|
32 | 147 | } |
|
33 | |||
34 | /** |
||
35 | * @param \PhpParser\Node\Stmt\Property[]|\PhpParser\Node\Stmt\ClassMethod $classMembers |
||
36 | * @return \PhpParser\Node\Stmt\Property[]|\PhpParser\Node\Stmt\ClassMethod |
||
37 | */ |
||
38 | 111 | protected function runFilters(array $classMembers): array |
|
39 | { |
||
40 | 111 | $attributes = $classMembers; |
|
41 | 111 | foreach ($this->filters as $filter) { |
|
42 | 33 | $attributes = array_filter($attributes, [$filter, 'accept']); |
|
43 | } |
||
44 | 111 | return $attributes; |
|
45 | } |
||
46 | |||
47 | /** @param \PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassMethod $member */ |
||
48 | 99 | protected function resolveVisibility($member): string |
|
57 | } |
||
58 | } |
||
59 | } |
||
60 |