| Conditions | 3 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 3 |
| Changes | 3 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 19 | 7 | public function parse($html) |
|
| 20 | { |
||
| 21 | 7 | $html = ltrim($html); |
|
| 22 | |||
| 23 | // Get token position. |
||
| 24 | 7 | $positionArray = HtmlTokenizer::getPosition($html); |
|
| 25 | 7 | $this->setLine($positionArray['line']); |
|
| 26 | 7 | $this->setPosition($positionArray['position']); |
|
| 27 | |||
| 28 | // Parse token. |
||
| 29 | 7 | $startPos = 3; |
|
| 30 | 7 | if (mb_substr($html, 0, 5) == '<?php') { |
|
| 31 | 7 | $startPos = 6; |
|
| 32 | 7 | } |
|
| 33 | |||
| 34 | 7 | $posOfEndOfPhp = mb_strpos($html, '?>'); |
|
| 35 | 7 | if ($posOfEndOfPhp === false) { |
|
| 36 | 1 | $this->value = trim(mb_substr($html, $startPos)); |
|
| 37 | |||
| 38 | 1 | return ''; |
|
| 39 | } |
||
| 40 | |||
| 41 | 6 | $this->value = trim(mb_substr($html, $startPos, $posOfEndOfPhp - $startPos - 1)); |
|
| 42 | |||
| 43 | 6 | return mb_substr($html, $posOfEndOfPhp + 2); |
|
| 44 | } |
||
| 45 | |||
| 66 |