Total Complexity | 9 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Coverage | 86.96% |
Changes | 0 |
1 | <?php |
||
9 | final class DriverChain implements AdvancedDriverInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var DriverInterface[] |
||
13 | */ |
||
14 | private $drivers; |
||
15 | |||
16 | /** |
||
17 | * @param DriverInterface[] $drivers |
||
18 | */ |
||
19 | 4 | public function __construct(array $drivers = []) |
|
22 | 4 | } |
|
23 | |||
24 | public function addDriver(DriverInterface $driver): void |
||
25 | { |
||
26 | $this->drivers[] = $driver; |
||
27 | } |
||
28 | |||
29 | 2 | public function loadMetadataForClass(\ReflectionClass $class): ?ClassMetadata |
|
30 | { |
||
31 | 2 | foreach ($this->drivers as $driver) { |
|
32 | 1 | if (null !== $metadata = $driver->loadMetadataForClass($class)) { |
|
33 | 1 | return $metadata; |
|
34 | } |
||
35 | } |
||
36 | |||
37 | 1 | return null; |
|
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritDoc} |
||
42 | */ |
||
43 | 2 | public function getAllClassNames(): array |
|
64 | } |
||
65 | } |
||
66 |