Conditions | 4 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
43 | public function fill() { |
||
44 | foreach (new RecursIter($this->getControlElement(), RecursIter::SELF_FIRST) as $option) |
||
45 | if ( |
||
46 | $option instanceof html\Option && |
||
47 | $option->getAttribute('value') == $this->getValueToUse() |
||
48 | ) |
||
49 | $option->setAttribute('selected', true); |
||
50 | |||
51 | $template = $this->getFieldTemplateClone('SELECT'); |
||
52 | |||
53 | $this['_TEMPLATE'] = $template; |
||
54 | $template->init($this, $this->control); |
||
55 | |||
56 | $this->filled = true; |
||
57 | |||
58 | return $template; |
||
59 | } |
||
60 | |||
78 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: