| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public static function convertBinaryToString(string $binaryRepresentation, bool $applyBase64 = false): string |
||
| 36 | { |
||
| 37 | $output = ''; |
||
| 38 | $binaryStringLength = \strlen($binaryRepresentation); |
||
| 39 | for ($i = 0; $i < $binaryStringLength; $i += 8) { |
||
| 40 | $output .= \chr(base_convert(substr($binaryRepresentation, $i, 8), 2, 10)); |
||
| 41 | } |
||
| 42 | |||
| 43 | if ($applyBase64 === true) { |
||
| 44 | return base64_encode($output); |
||
| 45 | } |
||
| 46 | |||
| 47 | return $output; |
||
| 48 | } |
||
| 50 |