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