| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | final class Combined extends Wrapper |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @param Dictionary<E> ...$dictionaries |
||
| 17 | */ |
||
| 18 | 9 | public function __construct(string $name, Dictionary ...$dictionaries) |
|
| 19 | { |
||
| 20 | 9 | parent::__construct( |
|
| 21 | 9 | new Invokable($name, function () use ($dictionaries) { |
|
| 22 | 6 | $data = []; |
|
| 23 | |||
| 24 | 6 | foreach ($dictionaries as $dictionary) { |
|
| 25 | 6 | $data = $this->merge($data, iterator_to_array($dictionary)); |
|
| 26 | } |
||
| 27 | |||
| 28 | 6 | return $data; |
|
| 29 | 9 | }) |
|
| 30 | ); |
||
| 31 | 9 | } |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @param E[] $array1 |
||
| 35 | * @param E[] $array2 |
||
| 36 | * |
||
| 37 | * @return E[] |
||
| 38 | */ |
||
| 39 | 6 | private function merge(array $array1, array $array2): array |
|
| 54 | } |
||
| 55 | } |
||
| 56 |