Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | trait CollectionTrait |
||
9 | { |
||
10 | /** |
||
11 | * @see CollectionInterface::add() |
||
12 | */ |
||
13 | abstract public function add($element): bool; |
||
14 | |||
15 | /** |
||
16 | * @see CollectionInterface::addAll() |
||
17 | */ |
||
18 | 6 | public function addAll(iterable $elements): bool |
|
19 | { |
||
20 | 6 | $b = true; |
|
21 | |||
22 | 6 | foreach ($elements as $item) { |
|
23 | 6 | $b = $this->add($item) && $b; |
|
24 | } |
||
25 | |||
26 | 6 | return $b; |
|
27 | } |
||
28 | |||
29 | /** |
||
30 | * @see CollectionInterface::clear() |
||
31 | */ |
||
32 | abstract public function clear(): void; |
||
33 | |||
34 | /** |
||
35 | * @see CollectionInterface::replace() |
||
36 | */ |
||
37 | 3 | public function replace(iterable $elements): bool |
|
42 | } |
||
43 | } |
||
44 |