1 | <?php |
||
15 | class Local extends Scanner{ |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $avPath; |
||
21 | |||
22 | /** |
||
23 | * STDIN and STDOUT descriptors |
||
24 | * @var array of resources |
||
25 | */ |
||
26 | private $pipes = []; |
||
27 | |||
28 | /** |
||
29 | * Process handle |
||
30 | * @var resource |
||
31 | */ |
||
32 | private $process; |
||
33 | |||
34 | 3 | public function __construct(AppConfig $config){ |
|
35 | 3 | $this->appConfig = $config; |
|
36 | // get the path to the executable |
||
37 | 3 | $this->avPath = escapeshellcmd($this->appConfig->getAvPath()); |
|
38 | |||
39 | // check that the executable is available |
||
40 | 3 | if (!file_exists($this->avPath)) { |
|
41 | 1 | throw new \RuntimeException('The antivirus executable could not be found at ' . $this->avPath); |
|
42 | } |
||
43 | 2 | } |
|
44 | |||
45 | 2 | public function initScanner(){ |
|
61 | |||
62 | 2 | protected function shutdownScanner(){ |
|
74 | } |
||
75 |
If you suppress an error, we recommend checking for the error condition explicitly: