| Conditions | 9 |
| Paths | 9 |
| Total Lines | 39 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 20 |
| CRAP Score | 9 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | 271 | protected static function valueToString($value): string |
|
| 33 | { |
||
| 34 | 271 | if (null === $value) { |
|
| 35 | 2 | return 'null'; |
|
| 36 | } |
||
| 37 | |||
| 38 | 269 | if (true === $value) { |
|
| 39 | 2 | return 'true'; |
|
| 40 | } |
||
| 41 | |||
| 42 | 267 | if (false === $value) { |
|
| 43 | 2 | return 'false'; |
|
| 44 | } |
||
| 45 | |||
| 46 | 265 | if (is_array($value)) { |
|
| 47 | 4 | return 'array'; |
|
| 48 | } |
||
| 49 | |||
| 50 | 261 | if (is_object($value)) { |
|
| 51 | 4 | if (method_exists($value, '__toString')) { |
|
| 52 | 2 | $format = '%1$s: %2$s'; |
|
| 53 | |||
| 54 | 2 | return sprintf($format, get_class($value), self::valueToString($value->__toString())); |
|
| 55 | } |
||
| 56 | |||
| 57 | 2 | return get_class($value); |
|
| 58 | } |
||
| 59 | |||
| 60 | 259 | if (is_resource($value)) { |
|
| 61 | 2 | return 'resource'; |
|
| 62 | } |
||
| 63 | |||
| 64 | 257 | if (is_string($value)) { |
|
| 65 | 229 | $format = '"%1$s"'; |
|
| 66 | |||
| 67 | 229 | return sprintf($format, $value); |
|
| 68 | } |
||
| 69 | |||
| 70 | 75 | return (string) $value; |
|
| 71 | } |
||
| 73 |