| Conditions | 9 |
| Paths | 9 |
| Total Lines | 36 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 20 |
| CRAP Score | 9 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | 421 | protected static function valueToString($value): string |
|
| 40 | { |
||
| 41 | 421 | if (null === $value) { |
|
| 42 | 3 | return 'null'; |
|
| 43 | } |
||
| 44 | |||
| 45 | 418 | if (true === $value) { |
|
| 46 | 6 | return 'true'; |
|
| 47 | } |
||
| 48 | |||
| 49 | 412 | if (false === $value) { |
|
| 50 | 9 | return 'false'; |
|
| 51 | } |
||
| 52 | |||
| 53 | 403 | if (is_array($value)) { |
|
| 54 | 12 | return 'array'; |
|
| 55 | } |
||
| 56 | |||
| 57 | 391 | if (is_object($value)) { |
|
| 58 | 6 | if (method_exists($value, '__toString')) { |
|
| 59 | 3 | $format = '%1$s: %2$s'; |
|
| 60 | 3 | return sprintf($format, get_class($value), self::valueToString($value->__toString())); |
|
| 61 | } |
||
| 62 | 3 | return get_class($value); |
|
| 63 | } |
||
| 64 | |||
| 65 | 388 | if (is_resource($value)) { |
|
| 66 | 3 | return 'resource'; |
|
| 67 | } |
||
| 68 | |||
| 69 | 385 | if (is_string($value)) { |
|
| 70 | 337 | $format = '"%1$s"'; |
|
| 71 | 337 | return sprintf($format, $value); |
|
| 72 | } |
||
| 73 | |||
| 74 | 120 | return (string) $value; |
|
| 75 | } |
||
| 77 |