| Conditions | 8 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 72 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | public function convertToPHP($value) |
||
| 44 | { |
||
| 45 | if (empty($value) || '{}' === $value) { |
||
| 46 | return []; |
||
| 47 | } |
||
| 48 | |||
| 49 | if (gettype($value) !== 'string') { |
||
| 50 | throw new RuntimeException('Expected string, got: ' . gettype($value)); |
||
| 51 | } |
||
| 52 | |||
| 53 | $array = []; |
||
| 54 | |||
| 55 | if (preg_match_all(self::POSTGRES_SYNTAX_PATTERN, $value, $matches, PREG_SET_ORDER)) { |
||
| 56 | foreach ($matches as $match) { |
||
| 57 | if ('' !== $match[3]) { |
||
| 58 | $array[] = stripcslashes($match[3]); |
||
| 59 | } else { |
||
| 60 | $array[] = 'NULL' === $match[2] ? null : $match[2]; |
||
| 61 | } |
||
| 62 | } |
||
| 63 | } |
||
| 64 | |||
| 65 | return $array; |
||
| 66 | } |
||
| 68 |