| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public static function convertToBinaryRepresentation(string $rawString): string |
||
| 16 | { |
||
| 17 | $out = null; |
||
| 18 | $strLength = \strlen($rawString); |
||
| 19 | for ($a = 0; $a < $strLength; $a++) { |
||
| 20 | $dec = \ord($rawString[$a]); //determine symbol ASCII-code |
||
| 21 | $bin = sprintf('%08d', base_convert($dec, 10, 2)); //convert to binary representation and add leading zeros |
||
| 22 | $out .= $bin; |
||
| 23 | } |
||
| 24 | |||
| 25 | return $out; |
||
|
|
|||
| 26 | } |
||
| 50 |