| Conditions | 5 |
| Paths | 12 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | function queryHandler($clause, $query, $param){ |
||
| 17 | if(!$param){ |
||
| 18 | $stmt = $this->conn->query($query); |
||
| 19 | } |
||
| 20 | |||
| 21 | if($param){ |
||
| 22 | $stmt = $this->conn->prepare($query); |
||
| 23 | $result = $stmt->execute($param); |
||
| 24 | } |
||
| 25 | |||
| 26 | if($clause == 'SELECT'){ |
||
| 27 | return $stmt->fetchAll(\PDO::FETCH_ASSOC); |
||
| 28 | } |
||
| 29 | |||
| 30 | if($clause == 'INSERT'){ |
||
| 31 | return $this->conn->lastInsertId(); |
||
| 32 | } |
||
| 33 | |||
| 34 | return $stmt->rowCount(); |
||
| 35 | } |
||
| 36 | |||
| 58 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.