| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 12 |
| Ratio | 100 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 72 | View Code Duplication | public function exec($query) |
|
| 73 | { |
||
| 74 | try { |
||
| 75 | return parent::exec($query); |
||
| 76 | } catch (PDOException $e) { |
||
| 77 | if('HY000' !== $e->getCode()) { |
||
| 78 | throw $e; |
||
| 79 | } |
||
| 80 | $this->reconnect(); |
||
| 81 | return parent::exec($query); |
||
| 82 | } |
||
| 83 | } |
||
| 84 | } |
||
| 85 |
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: