Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 12 |
Ratio | 100 % |
Tests | 2 |
CRAP Score | 6.28 |
Changes | 0 |
1 | <?php |
||
54 | 2 | View Code Duplication | public function query($query) |
55 | { |
||
56 | try { |
||
57 | 2 | return parent::query($query); |
|
58 | } catch (PDOException $e) { |
||
59 | if('HY000' !== $e->getCode()) { |
||
60 | throw $e; |
||
61 | } |
||
62 | $this->reconnect(); |
||
63 | return parent::query($query); |
||
64 | } |
||
65 | } |
||
66 | |||
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: