| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 77 | 14 | public static function decodeName(string $string, int &$offset = 0): string |
|
| 78 | { |
||
| 79 | 14 | $len = ord($string[$offset]); |
|
| 80 | 14 | ++$offset; |
|
| 81 | |||
| 82 | 14 | if (0 === $len) { |
|
| 83 | 2 | return '.'; |
|
| 84 | } |
||
| 85 | |||
| 86 | 12 | $name = ''; |
|
| 87 | 12 | while (0 !== $len) { |
|
| 88 | 12 | $name .= substr($string, $offset, $len).'.'; |
|
| 89 | 12 | $offset += $len; |
|
| 90 | 12 | $len = ord($string[$offset]); |
|
| 91 | 12 | ++$offset; |
|
| 92 | } |
||
| 93 | |||
| 94 | 12 | return $name; |
|
| 95 | } |
||
| 96 | } |
||
| 97 |
If you suppress an error, we recommend checking for the error condition explicitly: