| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 12 |
| Ratio | 100 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 74 | View Code Duplication | public function setKey($key) |
|
| 75 | { |
||
| 76 | $this->hash = null; |
||
| 77 | |||
| 78 | if (empty($key)) { |
||
| 79 | $this->key = null; |
||
| 80 | return; |
||
| 81 | } |
||
| 82 | |||
| 83 | $this->key = (string) $key; |
||
| 84 | $this->hash = $this->makeHash($key); |
||
| 85 | } |
||
| 86 | |||
| 102 |
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: