Conditions | 4 |
Paths | 6 |
Total Lines | 19 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function __construct(string $nodeString, int $line) |
||
23 | { |
||
24 | parent::__construct($nodeString, $line); |
||
25 | $trimmed = ltrim($nodeString); |
||
26 | $pos = strpos($trimmed, ' '); |
||
27 | $name = $trimmed; |
||
28 | if (is_int($pos)) { |
||
|
|||
29 | $name = strstr($trimmed, ' ', true); |
||
30 | $value = trim(substr($trimmed, $pos + 1)); |
||
31 | if ($value !== '') { |
||
32 | $child = NodeFactory::get($value, $line); |
||
33 | $child->indent = null; |
||
34 | parent::add($child); |
||
35 | } |
||
36 | } |
||
37 | if ($this instanceof Tag) { |
||
38 | $this->tag = $name; |
||
39 | } else { |
||
40 | $this->anchor = $name; |
||
41 | } |
||
44 |