| Conditions | 7 |
| Paths | 15 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 12 | public function createNodeFromValue($value, ?Document $doc, int $flags): ?Node |
||
| 13 | { |
||
| 14 | try { |
||
| 15 | if (null !== $node = $this->createScalarOrNullNodeFromValue($value, $doc)) { |
||
| 16 | return $node; |
||
| 17 | } |
||
| 18 | |||
| 19 | if (\is_object($value)) { |
||
| 20 | return $this->createObjectNodeFromPropertyMap($value, $doc, $flags); |
||
| 21 | } |
||
| 22 | |||
| 23 | if (\is_array($value)) { |
||
| 24 | return $this->createArrayNodeFromPackedArray($value, $doc, $flags); |
||
| 25 | } |
||
| 26 | |||
| 27 | if ($flags & Node::IGNORE_INVALID_VALUES) { |
||
| 28 | return null; |
||
| 29 | } |
||
| 30 | } catch (InvalidNodeValueException $e) { |
||
| 31 | throw $e; |
||
| 32 | //@codeCoverageIgnoreStart |
||
| 33 | } catch (\Exception $e) { |
||
| 34 | throw new \Error('Unexpected ' . \get_class($e) . ": {$e->getMessage()}", 0, $e); |
||
| 35 | } |
||
| 36 | //@codeCoverageIgnoreEnd |
||
| 37 | |||
| 38 | throw new InvalidNodeValueException("Failed to create node from value of type '" . \gettype($value) . "'"); |
||
| 39 | } |
||
| 41 |