| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | protected function compile(string $statement): string |
||
| 22 | { |
||
| 23 | $path = \explode('->', $statement); |
||
| 24 | $key = $this->parseJsonPathArrayKeys(\array_pop($path)); |
||
| 25 | |||
| 26 | if (\count($key) === 1) { |
||
| 27 | return \sprintf( |
||
| 28 | '\'%s\' IN (SELECT [key] FROM openjson(%s%s))', |
||
| 29 | \array_shift($key), |
||
| 30 | $this->getField($statement), |
||
| 31 | $this->getPath(\implode('->', $path)) |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 35 | $path[] = \array_shift($key); |
||
| 36 | |||
| 37 | return \sprintf( |
||
| 38 | '%s IN (SELECT [key] FROM openjson(%s%s))', |
||
| 39 | \array_pop($key), |
||
| 40 | $this->getField($statement), |
||
| 41 | $this->getPath(\implode('->', $path)) |
||
| 42 | ); |
||
| 45 |