| Conditions | 4 |
| Paths | 8 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | public function getSql($key, $value, $mode) { |
||
| 10 | $args = []; |
||
| 11 | $inSql = []; |
||
| 12 | $count = count($value); |
||
| 13 | $value = array_values($value); // fix numeric index being different than $i |
||
| 14 | for ($i = 0; $i < $count; $i++) { |
||
| 15 | $args[$key . $i] = $value[$i]; |
||
| 16 | $inSql[] = ':' . $key . $i; |
||
| 17 | } |
||
| 18 | |||
| 19 | $notText = ''; |
||
| 20 | if (\Maphper\Maphper::FIND_NOT & $mode) { |
||
| 21 | $notText = ' NOT'; |
||
| 22 | } |
||
| 23 | |||
| 24 | if (count($inSql) == 0) return ['args' => [], 'sql' => '']; |
||
| 25 | else $sql = [$key . $notText . ' IN ( ' . implode(', ', $inSql) . ')']; |
||
| 26 | |||
| 27 | return ['args' => $args, 'sql' => $sql]; |
||
| 28 | } |
||
| 30 |