Conditions | 3 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 3 |
Changes | 4 | ||
Bugs | 0 | Features | 2 |
1 | <?php |
||
31 | 7 | public function parse($html) |
|
32 | { |
||
33 | 7 | self::$allHtml = $html; |
|
34 | 7 | $tokens = new TokenCollection(); |
|
35 | 7 | $remainingHtml = trim((string) $html); |
|
36 | 7 | while (mb_strlen($remainingHtml) > 0) { |
|
37 | 7 | $token = TokenFactory::buildFromHtml( |
|
38 | 7 | $remainingHtml, |
|
39 | 7 | null, |
|
40 | 7 | $this->throwOnError |
|
41 | 7 | ); |
|
42 | 7 | if ($token === false) { |
|
43 | // Error has occurred, so we stop. |
||
44 | 1 | break; |
|
45 | } |
||
46 | |||
47 | 7 | $remainingHtml = $token->parse($remainingHtml); |
|
48 | 7 | $tokens[] = $token; |
|
49 | 7 | } |
|
50 | |||
51 | 7 | return $tokens; |
|
52 | } |
||
53 | |||
74 |