Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
16 / 16 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
TreeDefinitions | |
100.00% |
16 / 16 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
makeDefinitions | |
100.00% |
16 / 16 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace pvc\struct\tree\di; |
6 | |
7 | use League\Container\Definition\Definition; |
8 | use League\Container\Definition\DefinitionInterface; |
9 | use pvc\struct\collection\Collection; |
10 | use pvc\struct\collection\CollectionFactory; |
11 | use pvc\struct\collection\CollectionOrdered; |
12 | use pvc\struct\collection\CollectionOrderedFactory; |
13 | use pvc\struct\tree\node\TreenodeFactoryOrdered; |
14 | use pvc\struct\tree\node\TreenodeFactoryUnordered; |
15 | use pvc\struct\tree\tree\TreeOrdered; |
16 | use pvc\struct\tree\tree\TreeUnordered; |
17 | |
18 | class TreeDefinitions |
19 | { |
20 | /** |
21 | * @return array<int, DefinitionInterface> |
22 | */ |
23 | public static function makeDefinitions(): array |
24 | { |
25 | return [ |
26 | |
27 | /** |
28 | * objects necessary to make a plain (unordered) tree |
29 | */ |
30 | (new Definition(Collection::class)), |
31 | (new Definition(CollectionFactory::class)), |
32 | (new Definition(TreenodeFactoryUnordered::class)) |
33 | ->addArgument(CollectionFactory::class), |
34 | (new Definition(TreeUnordered::class))->addArgument( |
35 | TreenodeFactoryUnordered::class |
36 | ), |
37 | |
38 | /** |
39 | * objects necessary to make an ordered tree |
40 | */ |
41 | (new Definition(CollectionOrdered::class)), |
42 | (new Definition(CollectionOrderedFactory::class)), |
43 | (new Definition(TreenodeFactoryOrdered::class)) |
44 | ->addArgument(CollectionOrderedFactory::class), |
45 | (new Definition(TreeOrdered::class))->addArgument( |
46 | TreenodeFactoryOrdered::class |
47 | ), |
48 | ]; |
49 | } |
50 | } |