| Total Complexity | 3 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | final class SimpleArray implements ImporterInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * {@inheritdoc} |
||
| 18 | */ |
||
| 19 | 1 | public function import($data): NodeInterface |
|
| 20 | { |
||
| 21 | 1 | return $this->parseNode(new AttributeNode(['label' => 'root']), $data); |
|
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Create a node. |
||
| 26 | * |
||
| 27 | * @param mixed $data |
||
| 28 | * The arguments |
||
| 29 | * |
||
| 30 | * @return AttributeNodeInterface |
||
| 31 | * The node |
||
| 32 | */ |
||
| 33 | 1 | private function createNode($data): AttributeNodeInterface |
|
| 34 | { |
||
| 35 | 1 | return new AttributeNode([ |
|
| 36 | 1 | 'data' => $data, |
|
| 37 | ]); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param AttributeNodeInterface $parent |
||
| 42 | * @param array ...$nodes |
||
| 43 | * |
||
| 44 | * @return \loophp\phptree\Node\NodeInterface |
||
| 45 | */ |
||
| 46 | 1 | private function parseNode(AttributeNodeInterface $parent, array ...$nodes): NodeInterface |
|
| 62 | ); |
||
| 63 | } |
||
| 64 | } |
||
| 65 |