| Conditions | 4 |
| Paths | 5 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.432 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 2 | public function execute($query) |
|
| 16 | { |
||
| 17 | try { |
||
| 18 | 2 | $ret = $this->resource->exec($query); |
|
|
|
|||
| 19 | 2 | if ($ret === false) { |
|
| 20 | 1 | throw new Exception\InvalidArgumentException("Cannot execute [$query]."); |
|
| 21 | } |
||
| 22 | 2 | } catch (Exception\InvalidArgumentException $e) { |
|
| 23 | 1 | throw $e; |
|
| 24 | } catch (\Exception $e) { |
||
| 25 | $msg = "PDOException : {$e->getMessage()} [$query]"; |
||
| 26 | throw new Exception\InvalidArgumentException($msg); |
||
| 27 | } |
||
| 28 | 2 | } |
|
| 29 | |||
| 76 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: