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