1 | <?php |
||
15 | class Local extends ScannerBase{ |
||
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, ILogger $logger){ |
|
35 | 3 | $this->appConfig = $config; |
|
36 | 3 | $this->logger = $logger; |
|
37 | |||
38 | // get the path to the executable |
||
39 | 3 | $this->avPath = escapeshellcmd($this->appConfig->getAvPath()); |
|
40 | |||
41 | // check that the executable is available |
||
42 | 3 | if (!file_exists($this->avPath)) { |
|
43 | 1 | throw new \RuntimeException('The antivirus executable could not be found at ' . $this->avPath); |
|
44 | } |
||
45 | 2 | } |
|
46 | |||
47 | 2 | public function initScanner(){ |
|
63 | |||
64 | 2 | protected function shutdownScanner(){ |
|
76 | } |
||
77 |
If you suppress an error, we recommend checking for the error condition explicitly: