1 | <?php |
||
26 | abstract class Scanner { |
||
27 | |||
28 | /** |
||
29 | * Scan result |
||
30 | * @var \OCA\Files_Antivirus\Status |
||
31 | */ |
||
32 | protected $status; |
||
33 | |||
34 | /** @var int */ |
||
35 | protected $byteCount; |
||
36 | |||
37 | /** @var resource */ |
||
38 | protected $writeHandle; |
||
39 | |||
40 | /** @var \OCA\Files_Antivirus\AppConfig */ |
||
41 | protected $appConfig; |
||
42 | |||
43 | |||
44 | /** |
||
45 | * Close used resources |
||
46 | */ |
||
47 | abstract protected function shutdownScanner(); |
||
48 | |||
49 | |||
50 | 2 | public function getStatus(){ |
|
56 | |||
57 | /** |
||
58 | * Synchronous scan |
||
59 | * @param IScannable $item |
||
60 | * @return Status |
||
61 | */ |
||
62 | 2 | public function scan(IScannable $item) { |
|
72 | |||
73 | /** |
||
74 | * Async scan - prepare resources |
||
75 | */ |
||
76 | public function initAsyncScan(){ |
||
79 | |||
80 | /** |
||
81 | * Async scan - new portion of data is available |
||
82 | * @param string $data |
||
83 | */ |
||
84 | public function onAsyncData($data){ |
||
87 | |||
88 | /** |
||
89 | * Async scan - resource is closed |
||
90 | * @return Status |
||
91 | */ |
||
92 | public function completeAsyncScan(){ |
||
96 | |||
97 | /** |
||
98 | * Open write handle. etc |
||
99 | */ |
||
100 | 2 | protected function initScanner(){ |
|
103 | |||
104 | /** |
||
105 | * @param string $chunk |
||
106 | */ |
||
107 | 2 | protected function writeChunk($chunk){ |
|
112 | |||
113 | 2 | protected function fwrite($data){ |
|
116 | |||
117 | /** |
||
118 | * Get a resource to write data into |
||
119 | * @return resource |
||
120 | */ |
||
121 | 2 | protected function getWriteHandle(){ |
|
124 | |||
125 | /** |
||
126 | * Prepare chunk (if required) |
||
127 | */ |
||
128 | 2 | protected function prepareChunk($data){ |
|
131 | } |
||
132 |
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.