1 | <?php |
||
17 | class Tidy extends PluginAbstract |
||
18 | { |
||
19 | |||
20 | public static $hook = array('response', 'late'); |
||
21 | |||
22 | /** |
||
23 | * @var array Options for tidy. |
||
24 | * @see http://tidy.sourceforge.net/docs/quickref.html |
||
25 | */ |
||
26 | protected $options = array( |
||
27 | 'enable' => true, // wether to enable or not |
||
28 | 'generic' => array( |
||
29 | // PHP Bug: commenting out 'indent' (with true or false) |
||
30 | // for some weird reason does chnage the Transfer-Encoding! |
||
31 | 'indent' => true, |
||
32 | 'indent-spaces' => 4, |
||
33 | 'wrap' => 80, |
||
34 | 'clean' => true |
||
35 | ), |
||
36 | 'html' => array( |
||
37 | 'tidy-mark' => true, |
||
38 | ), |
||
39 | 'xml' => array( |
||
40 | 'input-xml' => true, |
||
41 | 'output-xml' => true, |
||
42 | ) |
||
43 | ); |
||
44 | |||
45 | public function update(\SplSubject $response) |
||
81 | |||
82 | /** |
||
83 | * Tidy, sanitize the response output. |
||
84 | * |
||
85 | * @param string $string |
||
86 | * @param array $options |
||
87 | * @return string |
||
88 | */ |
||
89 | protected function tidy($string, array $options) |
||
97 | |||
98 | } |
||
99 |
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.