1 | <?php |
||
5 | class Arrays extends \Twig_Extension |
||
6 | { |
||
7 | public function getFunctions() |
||
8 | { |
||
9 | $self = array('is_safe' => array('all')); |
||
|
|||
10 | |||
11 | return array( |
||
12 | //new \Twig_SimpleFunction('magice_icon_color', array($this, 'getColor'), $self), |
||
13 | ); |
||
14 | } |
||
15 | |||
16 | public function getFilters() |
||
17 | { |
||
18 | $self = array('is_safe' => array('all')); |
||
19 | |||
20 | return array( |
||
21 | new \Twig_SimpleFilter('is_array', 'is_array'), |
||
22 | new \Twig_SimpleFilter('in_array', 'in_array'), |
||
23 | new \Twig_SimpleFilter('search_array', 'array_search'), |
||
24 | ); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @api |
||
29 | */ |
||
30 | public function getName() |
||
34 | } |
||
35 |
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.