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