Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public function addIcon($icon,$direction=Direction::LEFT){ |
||
11 | if($this->_hasIcon===false){ |
||
12 | $iconO=$icon; |
||
13 | if(\is_string($icon)){ |
||
14 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
||
|
|||
15 | } |
||
16 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
||
17 | $this->addContent($iconO,false); |
||
18 | $this->_hasIcon=true; |
||
19 | }else{ |
||
20 | $iconO=$this->getIcon(); |
||
21 | $iconO->setIcon($icon); |
||
22 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
||
23 | } |
||
24 | return $iconO; |
||
25 | } |
||
26 | |||
35 | } |
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: