Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
TreenodeCollectionFactory | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
makeTreenodeCollection | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare (strict_types = 1); |
4 | |
5 | namespace pvc\struct\tree\node; |
6 | |
7 | use pvc\interfaces\struct\collection\CollectionFactoryInterface; |
8 | use pvc\interfaces\struct\tree\node\TreenodeCollectionFactoryInterface; |
9 | use pvc\interfaces\struct\tree\node\TreenodeInterface; |
10 | |
11 | /** |
12 | * @template PayloadType |
13 | * @implements TreenodeCollectionFactoryInterface<PayloadType> |
14 | */ |
15 | class TreenodeCollectionFactory implements TreenodeCollectionFactoryInterface |
16 | { |
17 | /** |
18 | * @param CollectionFactoryInterface<TreenodeInterface<PayloadType>> $collectionFactory |
19 | */ |
20 | public function __construct( |
21 | protected CollectionFactoryInterface $collectionFactory) |
22 | { |
23 | } |
24 | |
25 | /** |
26 | * @param array<TreenodeInterface<PayloadType>> $treenodes |
27 | * @return TreenodeCollection<PayloadType> |
28 | */ |
29 | public function makeTreenodeCollection(array $treenodes = []): TreenodeCollection |
30 | { |
31 | return new TreenodeCollection($this->collectionFactory->makeCollection($treenodes)); |
32 | } |
33 | } |