| Conditions | 4 |
| Paths | 6 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 1 | public function __toString() |
|
| 33 | { |
||
| 34 | 1 | $length = mb_strlen($this->data, 'ASCII'); |
|
| 35 | |||
| 36 | 1 | $hex = []; |
|
| 37 | |||
| 38 | 1 | for ($p = 0; $p < $length; ++$p) { |
|
| 39 | 1 | $char = $this->data[$p]; |
|
| 40 | 1 | $hex[] = ord($char).(self::isPrintable($char) ? "[$char]" : ''); |
|
| 41 | 1 | } |
|
| 42 | |||
| 43 | 1 | return ($this->label ? $this->label.' ' : '').$length.' bytes: '.implode(' ', $hex); |
|
| 44 | } |
||
| 45 | |||
| 56 |