| Conditions | 5 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function __invoke(array $array) : string |
||
| 25 | { |
||
| 26 | return '[' . implode(', ', array_map(static function ($param) { |
||
| 27 | if (is_resource($param)) { |
||
| 28 | return (string) $param; |
||
| 29 | } |
||
| 30 | |||
| 31 | $json = @json_encode($param); |
||
| 32 | |||
| 33 | if (! is_string($json) || $json === 'null' && is_string($param)) { |
||
|
|
|||
| 34 | // JSON encoding failed, this is not a UTF-8 string. |
||
| 35 | return sprintf('"%s"', preg_replace('/.{2}/', '\\x$0', bin2hex($param))); |
||
| 36 | } |
||
| 37 | |||
| 38 | return $json; |
||
| 39 | }, $array)) . ']'; |
||
| 40 | } |
||
| 42 |