Total Complexity | 8 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
13 | final class IndexSet implements IndexSetInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var IndexInterface[] |
||
17 | */ |
||
18 | private $indexes; |
||
19 | |||
20 | |||
21 | /** |
||
22 | * IndexSet constructor. |
||
23 | * |
||
24 | * @param IndexInterface[] $indexes |
||
25 | */ |
||
26 | 786 | public function __construct(array $indexes) |
|
32 | } |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | 14 | public function primary(): ?IndexInterface |
|
39 | { |
||
40 | 14 | foreach ($this->indexes as $index) { |
|
41 | 13 | if ($index->primary()) { |
|
42 | 11 | return $index; |
|
43 | } |
||
44 | } |
||
45 | |||
46 | 3 | return null; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | 768 | public function all(): array |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | 12 | public function get(string $name): IndexInterface |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 8 | public function has(string $name): bool |
|
73 |