Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
32 | public static function load(array $data, ?BlockNode $parent = null): self |
||
33 | { |
||
34 | self::checkNodeData(static::class, $data); |
||
35 | |||
36 | $node = new self($data['attrs']['order'] ?? null, $parent); |
||
37 | |||
38 | // set content if defined |
||
39 | if (\array_key_exists('content', $data)) { |
||
40 | foreach ($data['content'] as $nodeData) { |
||
41 | $class = Node::NODE_MAPPING[$nodeData['type']]; |
||
42 | $child = $class::load($nodeData, $node); |
||
43 | |||
44 | $node->append($child); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | return $node; |
||
49 | } |
||
62 |