Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
22 | 22 | public function parse(Source $source) |
|
23 | { |
||
24 | 22 | $length = intval($source->match('/\GS:([+]?[0-9]+):"/'), 10); |
|
25 | 13 | $result = array(); |
|
26 | 13 | for ($i = 0; $i < $length; ++$i) { |
|
27 | 12 | $char = $source->read(1); |
|
28 | 12 | if ($char !== '\\') { |
|
29 | 3 | $result[] = $char; |
|
30 | 3 | continue; |
|
31 | } |
||
32 | 9 | $result[] = chr(base_convert(($source->match('/\G[0-9a-fA-F]{2}/')), 16, 10)); |
|
33 | 6 | } |
|
34 | 10 | $source->consume('";', self::CLOSE_STRING_LENGTH); |
|
35 | 9 | return array(implode('', $result), $source); |
|
36 | } |
||
37 | } |
||
38 |