1 | <?php namespace Sunspikes\ClamavValidator; |
||
8 | class ClamavValidator extends Validator |
||
9 | { |
||
10 | /** |
||
11 | * @const string CLAMAV_STATUS_OK |
||
12 | */ |
||
13 | const CLAMAV_STATUS_OK = 'OK'; |
||
14 | |||
15 | /** |
||
16 | * @const string CLAMAV_STATUS_ERROR |
||
17 | */ |
||
18 | const CLAMAV_STATUS_ERROR = 'ERROR'; |
||
19 | |||
20 | /** |
||
21 | * @const string CLAMAV_UNIX_SOCKET |
||
22 | */ |
||
23 | const CLAMAV_UNIX_SOCKET = '/var/run/clamav/clamd.ctl'; |
||
24 | |||
25 | /** |
||
26 | * @const string CLAMAV_LOCAL_TCP_SOCKET |
||
27 | */ |
||
28 | const CLAMAV_LOCAL_TCP_SOCKET = 'tcp://127.0.0.1:3310'; |
||
29 | |||
30 | /** |
||
31 | * @const string CLAMAV_SOCKET_READ_TIMEOUT |
||
32 | */ |
||
33 | const CLAMAV_SOCKET_READ_TIMEOUT = 30; |
||
34 | |||
35 | /** |
||
36 | * Creates a new instance of ClamavValidator |
||
37 | */ |
||
38 | 4 | public function __construct($translator, $data, $rules, $messages) |
|
42 | |||
43 | /** |
||
44 | * Validate the uploaded file for virus/malware with ClamAV |
||
45 | * |
||
46 | * @param $attribute string |
||
47 | * @param $value mixed |
||
48 | * @param $parameters array |
||
49 | * |
||
50 | * @return boolean |
||
51 | * @throws ClamavValidatorException |
||
52 | */ |
||
53 | 3 | public function validateClamav($attribute, $value, $parameters) |
|
74 | |||
75 | /** |
||
76 | * Guess the ClamAV socket |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | 3 | protected function getClamavSocket() |
|
88 | |||
89 | /** |
||
90 | * Return the file path from the passed object |
||
91 | * |
||
92 | * @param $file mixed |
||
93 | * @return string |
||
94 | */ |
||
95 | 3 | protected function getFilePath($file) |
|
110 | } |
||
111 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.