Conditions | 3 |
Paths | 3 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
15 | public function parse(string $html) : string |
||
16 | { |
||
17 | $html = ltrim($html); |
||
18 | |||
19 | // Get token position. |
||
20 | $positionArray = HtmlTokenizer::getPosition($html); |
||
21 | $this->line = $positionArray['line']; |
||
22 | $this->position = $positionArray['position']; |
||
23 | |||
24 | // Parse token. |
||
25 | $posOfEndOfComment = mb_strpos($html, '-->'); |
||
26 | if ($posOfEndOfComment === false) { |
||
27 | if ($this->getThrowOnError()) { |
||
28 | throw new ParseException('Invalid comment.'); |
||
29 | } |
||
30 | |||
31 | return ''; |
||
32 | } |
||
33 | |||
34 | $this->value = trim(mb_substr($html, 4, $posOfEndOfComment - 4)); |
||
35 | |||
36 | return mb_substr($html, $posOfEndOfComment + 3); |
||
37 | } |
||
38 | |||
49 |