Passed
Pull Request — master (#30)
by
unknown
46:28 queued 21:27
created

VisibilityFilters   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 22
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A apply() 0 7 2
A __construct() 0 3 1
1
<?php declare(strict_types=1);
2
/**
3
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
4
 */
5
6
namespace PhUml\Parser\Code\Builders\Members;
7
8
use PhpParser\Node\Param;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node\Param was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use PhpParser\Node\Stmt;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node\Stmt was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use PhpParser\Node\Stmt\ClassConst;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node\Stmt\ClassConst was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use PhpParser\Node\Stmt\ClassMethod;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node\Stmt\ClassMethod was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use PhpParser\Node\Stmt\Property;
0 ignored issues
show
Bug introduced by
The type PhpParser\Node\Stmt\Property was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use PhUml\Parser\Code\Builders\Filters\VisibilityFilter;
14
15
/**
16
 * It can run one or more `VisibilityFilter`s.
17
 * Filters will exclude:
18
 *
19
 * - protected members
20
 * - private members
21
 * - both protected and private members if both filters are provided
22
 *
23
 * @see PrivateVisibilityFilter
24
 * @see ProtectedVisibilityFilter
25
 */
26
final class VisibilityFilters
27
{
28
    /** @var VisibilityFilter[] */
29
    private readonly array $filters;
30
31
    /** @param VisibilityFilter[] $filters */
32 56
    public function __construct(array $filters = [])
33
    {
34 56
        $this->filters = $filters;
0 ignored issues
show
Bug introduced by
The property filters is declared read-only in PhUml\Parser\Code\Builde...mbers\VisibilityFilters.
Loading history...
35
    }
36
37
    /**
38
     * @param Property[]|ClassMethod[]|ClassConst[]|Param[] $definitionMembers
39
     * @return Property[]|ClassMethod[]|ClassConst[]|Param[]
40
     */
41 47
    public function apply(array $definitionMembers): array
42
    {
43 47
        $members = $definitionMembers;
44 47
        foreach ($this->filters as $filter) {
45 14
            $members = array_filter($members, static fn (Stmt|Param $member): bool => $filter->accept($member));
46
        }
47 47
        return $members;
48
    }
49
}
50