Conditions | 4 |
Paths | 6 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public function addIcon($icon,$before=true,$labeled=false){ |
||
17 | $iconO=$icon; |
||
18 | if(\is_string($icon)){ |
||
19 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
||
|
|||
20 | } |
||
21 | if($labeled!==false){ |
||
22 | $direction=($before===true)?Direction::RIGHT:Direction::LEFT; |
||
23 | $this->addToProperty("class", $direction." labeled icon"); |
||
24 | $this->tagName="div"; |
||
25 | } |
||
26 | $this->addContent($iconO,$before); |
||
27 | return $iconO; |
||
28 | } |
||
29 | } |
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: