Conditions | 3 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 3 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
24 | protected static function transformWrapInQuotes(string $content) { |
||
25 | // If string is already wrapped in quotes, we do nothing and |
||
26 | // assume that it's a valid JSON formatted string or array of strings. |
||
27 | if(starts_with($content, '"') && ends_with($content, '"')) { |
||
28 | return $content; |
||
29 | } |
||
30 | |||
31 | // If it's not, then we should escape the string and wrap in quotes. |
||
32 | // json_encode fits perfectly there. |
||
33 | return json_encode($content); |
||
34 | } |
||
64 |