Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
26 | private function fillObject(string $param) |
||
27 | { |
||
28 | if ($param == 'nullable') { |
||
29 | return $this->nullable = true; |
||
30 | } |
||
31 | |||
32 | if ($param == 'unique') { |
||
33 | return $this->unique = true; |
||
34 | } |
||
35 | |||
36 | if ($param == 'foreign') { |
||
37 | return $this->foreign = true; |
||
38 | } |
||
39 | |||
40 | if (starts_with($param, 'default(')) { |
||
41 | preg_match('/\((.*)\)/', $param, $match); |
||
42 | |||
43 | return $this->default = $match[1]; |
||
44 | } |
||
45 | } |
||
46 | |||
93 |
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: