1 | <?php |
||
31 | abstract class AbstractConditionViewHelper extends AbstractViewHelper |
||
32 | { |
||
33 | protected $escapeOutput = false; |
||
34 | |||
35 | /** |
||
36 | * @return void |
||
37 | */ |
||
38 | public function initializeArguments() |
||
43 | |||
44 | /** |
||
45 | * Renders <f:then> child if $condition is true, otherwise renders <f:else> child. |
||
46 | * Method which only gets called if the template is not compiled. For static calling, |
||
47 | * the then/else nodes are converted to closures and condition evaluation closures. |
||
48 | * |
||
49 | * @return mixed |
||
50 | */ |
||
51 | public function render() |
||
58 | |||
59 | /** |
||
60 | * Override this method for a custom decision whether or not to render the ViewHelper |
||
61 | * |
||
62 | * @return bool |
||
63 | */ |
||
64 | protected function condition(): bool |
||
68 | |||
69 | /** |
||
70 | * Returns value of "then" attribute. |
||
71 | * If then attribute is not set, iterates through child nodes and renders ThenViewHelper. |
||
72 | * If then attribute is not set and no ThenViewHelper and no ElseViewHelper is found, all child nodes are rendered |
||
73 | * |
||
74 | * @return mixed rendered ThenViewHelper or contents of <f:if> if no ThenViewHelper was found |
||
75 | */ |
||
76 | protected function renderThenChild() |
||
98 | |||
99 | /** |
||
100 | * Returns value of "else" attribute. |
||
101 | * If else attribute is not set, iterates through child nodes and renders ElseViewHelper. |
||
102 | * If else attribute is not set and no ElseViewHelper is found, an empty string will be returned. |
||
103 | * |
||
104 | * @return string rendered ElseViewHelper or an empty string if no ThenViewHelper was found |
||
105 | */ |
||
106 | protected function renderElseChild() |
||
125 | } |
||
126 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.