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