Total Complexity | 9 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Coverage | 65% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
7 | final class UnsafeNodeFactory extends NodeFactory |
||
8 | { |
||
9 | /** |
||
10 | * @throws Exception |
||
11 | */ |
||
12 | 30 | private function createVectorNodeFromArray(array $values, ?Document $doc, int $flags): VectorNode |
|
13 | { |
||
14 | 30 | $i = 0; |
|
15 | 30 | $packed = true; |
|
16 | |||
17 | 30 | foreach ($values as $key => $value) { |
|
18 | 25 | if ($key !== $i++) { |
|
19 | $packed = false; |
||
20 | 25 | break; |
|
21 | } |
||
22 | } |
||
23 | |||
24 | 30 | return $packed |
|
25 | 30 | ? $this->createArrayNodeFromPackedArray($values, $doc, $flags) |
|
26 | 30 | : $this->createObjectNodeFromPropertyMap($values, $doc, $flags); |
|
27 | } |
||
28 | |||
29 | /** |
||
30 | * @throws Exception |
||
31 | */ |
||
32 | private function createNodeFromObject(object $object, ?Document $doc, int $flags): ?Node |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @inheritdoc |
||
41 | */ |
||
42 | 30 | protected function createVectorNodeFromValue($value, ?Document $doc, int $flags): ?Node |
|
55 |