Conditions | 4 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function getPart($partKey, $index=NULL,$force=false) { |
||
20 | if (\array_key_exists($partKey, $this->content)) { |
||
21 | if (isset($index)) |
||
22 | return $this->content[$partKey][$index]; |
||
23 | return $this->content[$partKey]; |
||
24 | } |
||
25 | if($force){ |
||
26 | return new HtmlSemDoubleElement($partKey."-".$this->identifier,"div",$partKey); |
||
|
|||
27 | } |
||
28 | return NULL; |
||
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: