1 | <?php |
||
8 | class Condition |
||
9 | { |
||
10 | protected $_string; |
||
11 | protected $_values; |
||
12 | protected $_query; |
||
13 | |||
14 | /** |
||
15 | * @param string $string |
||
16 | */ |
||
17 | 13 | public function __construct($string, $values = array()) |
|
22 | |||
23 | 6 | public function __toString() |
|
27 | |||
28 | 12 | public function getString() |
|
32 | |||
33 | /** |
||
34 | * Parses $string and replaces all instances of "?" with corresponding $values |
||
35 | * |
||
36 | * @param string $string |
||
37 | * @param array $values |
||
38 | * @return string |
||
39 | */ |
||
40 | 12 | public function parseString($string, $values) |
|
79 | |||
80 | /** |
||
81 | * @param Query $value |
||
82 | */ |
||
83 | 1 | protected function parseValueQuery($value) |
|
87 | |||
88 | /** |
||
89 | * @return Query |
||
90 | */ |
||
91 | 1 | public function getQuery() |
|
95 | |||
96 | /** |
||
97 | * @param Query $query |
||
98 | * @return $this |
||
99 | */ |
||
100 | 13 | public function setQuery($query) |
|
106 | |||
107 | /** |
||
108 | * @param Condition $condition |
||
109 | */ |
||
110 | 5 | public function and_($condition) |
|
114 | |||
115 | /** |
||
116 | * @param Condition $condition |
||
117 | */ |
||
118 | 4 | public function or_($condition) |
|
122 | |||
123 | 7 | public function protectCondition($condition) |
|
127 | } |
||
128 |
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.