Conditions | 4 |
Paths | 2 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
18 | 1 | protected function confirm($message) |
|
19 | { |
||
20 | 1 | $hash = md5($message); |
|
21 | 1 | if (!property_exists($this, '_confirmations') || !is_array($this->_confirmations) || !in_array($hash, $this->_confirmations)) { |
|
|
|||
22 | 1 | throw new Exception(json_encode([ |
|
23 | 1 | 'type' => 'confirm', |
|
24 | 1 | 'message' => $message, |
|
25 | 1 | 'hash' => $hash |
|
26 | ])); |
||
27 | } |
||
28 | 1 | } |
|
29 | } |
||
30 |
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: