Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | protected function getWidgetsFor($view) |
||
14 | { |
||
15 | $name = $view . "Widgets"; |
||
16 | |||
17 | if ( |
||
18 | in_array($view, ['create', 'update']) && |
||
19 | (empty($this->updateWidgets) && empty($this->createWidgets)) |
||
20 | ) { |
||
21 | $name = 'formsWidgets'; |
||
22 | } |
||
23 | |||
24 | if (property_exists($this, $name)) { |
||
25 | return $this->$name; |
||
26 | } |
||
27 | |||
28 | return null; |
||
29 | } |
||
30 | } |
||
31 |
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: