Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
TreenodeFactory
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 makeNode
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * @author: Doug Wilbourne (dougwilbourne@gmail.com)
5 */
6declare(strict_types=1);
7
8namespace pvc\struct\tree\node;
9
10use pvc\interfaces\struct\tree\node\TreenodeChildCollectionFactoryInterface;
11use pvc\interfaces\struct\tree\node\TreenodeFactoryInterface;
12use pvc\interfaces\struct\tree\node\TreenodeInterface;
13
14/**
15 * Class TreenodeFactory
16 *
17 * @template TreenodeType of TreenodeInterface
18 * @implements TreenodeFactoryInterface<TreenodeType>
19 */
20class TreenodeFactory implements TreenodeFactoryInterface
21{
22    /**
23     * @param  TreenodeChildCollectionFactoryInterface<TreenodeType>  $collectionFactory
24     */
25    public function __construct(
26        protected TreenodeChildCollectionFactoryInterface $collectionFactory,
27    ) {
28    }
29
30    /**
31     * @return Treenode<TreenodeType>
32     */
33    public function makeNode(): Treenode
34    {
35        return new Treenode($this->collectionFactory);
36    }
37}