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