Conditions | 5 |
Paths | 5 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
22 | public function convertToSQL($value): string |
||
23 | { |
||
24 | if (empty($value)) { |
||
25 | return '{}'; |
||
26 | } |
||
27 | |||
28 | $result = ''; |
||
29 | |||
30 | foreach ($value as $part) { |
||
31 | if (null === $part) { |
||
32 | $result .= 'NULL,'; |
||
33 | } elseif ('' === $part) { |
||
34 | $result .= '"",'; |
||
35 | } else { |
||
36 | $result .= '"' . addcslashes($part, '"') . '",'; |
||
37 | } |
||
38 | } |
||
39 | |||
40 | return '{' . substr($result, 0, -1) . '}'; |
||
41 | } |
||
68 |