| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 16 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 3 | public function __construct(string $nodeString, int $line) |
|
| 14 | { |
||
| 15 | 3 | parent::__construct($nodeString, $line); |
|
| 16 | 3 | $trimmed = ltrim($nodeString); |
|
| 17 | 3 | $pos = strpos($trimmed, ' '); |
|
| 18 | 3 | $name = $trimmed; |
|
| 19 | 3 | if (is_int($pos)) { |
|
|
|
|||
| 20 | 3 | $name = strstr($trimmed, ' ', true); |
|
| 21 | 3 | $value = trim(substr($trimmed, $pos + 1)); |
|
| 22 | 3 | if ($value !== '') { |
|
| 23 | 3 | $child = NodeFactory::get($value, $line); |
|
| 24 | 3 | $child->indent = null; |
|
| 25 | 3 | $this->add($child); |
|
| 26 | } |
||
| 27 | } |
||
| 28 | 3 | if ($this instanceof NodeTag) { |
|
| 29 | 1 | $this->tag = $name; |
|
| 30 | 1 | return; |
|
| 31 | } |
||
| 32 | 3 | $this->anchor = $name; |
|
| 33 | 3 | } |
|
| 39 | } |