| Conditions | 4 |
| Paths | 4 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4.0072 |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | 2 | public function select($fields, string $table, array $params = []) |
|
| 14 | { |
||
| 15 | 2 | if (is_array($fields)) { |
|
| 16 | $fields = implode(', ', $fields); |
||
| 17 | } |
||
| 18 | |||
| 19 | 2 | $query = "SELECT $fields FROM $table"; |
|
| 20 | 2 | $binds = []; |
|
| 21 | |||
| 22 | 2 | if (count($params)) { |
|
| 23 | 1 | $where = []; |
|
| 24 | 1 | foreach ($params as $k => $v) { |
|
| 25 | 1 | $binds[$k] = (array) $v; |
|
| 26 | 1 | $where[] = $k.' in (:'.$k.')'; |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | $where = implode(' and ', $where); |
|
| 30 | |||
| 31 | 1 | $query .= " where $where"; |
|
| 32 | } |
||
| 33 | |||
| 34 | 2 | return $this->get(Client::class)->select($query, $binds); |
|
| 35 | } |
||
| 36 | |||
| 53 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.