CompositeAcceptor   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 7
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A accepts() 0 9 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Annotations\Assembler\Acceptor;
6
7
use Doctrine\Annotations\Parser\Ast\Reference;
8
use Doctrine\Annotations\Parser\Scope;
9
10
final class CompositeAcceptor implements ReferenceAcceptor
11
{
12
    /** @var ReferenceAcceptor[] */
13
    private $acceptors;
14
15 1
    public function __construct(ReferenceAcceptor ...$acceptors)
16
    {
17 1
        $this->acceptors = $acceptors;
18 1
    }
19
20 1
    public function accepts(Reference $reference, Scope $scope) : bool
21
    {
22 1
        foreach ($this->acceptors as $acceptor) {
23 1
            if (! $acceptor->accepts($reference, $scope)) {
24 1
                return false;
25
            }
26
        }
27
28 1
        return true;
29
    }
30
}
31