1111
1212namespace AMWScan ;
1313
14- use RecursiveDirectoryIterator ;
15- use RecursiveIteratorIterator ;
16- use RuntimeException ;
17-
1814class Actions
1915{
2016 /**
2117 * Put contents.
2218 *
23- * @param $filename
24- * @param $data
2519 * @param int $flags
2620 * @param null $context
2721 *
@@ -39,9 +33,6 @@ public static function putContents($filename, $data, $flags = 0, $context = null
3933 /**
4034 * Clean Evil Code.
4135 *
42- * @param $code
43- * @param $patternFound
44- *
4536 * @return string|string[]|null
4637 */
4738 public static function cleanEvilCode ($ code , $ patternFound )
@@ -64,9 +55,6 @@ public static function cleanEvilCode($code, $patternFound)
6455 /**
6556 * Clean Evil Code Line.
6657 *
67- * @param $code
68- * @param $patternFound
69- *
7058 * @return string
7159 */
7260 public static function cleanEvilCodeLine ($ code , $ patternFound )
@@ -82,8 +70,6 @@ public static function cleanEvilCodeLine($code, $patternFound)
8270 /**
8371 * Delete File.
8472 *
85- * @param $file
86- *
8773 * @return bool
8874 */
8975 public static function deleteFile ($ file )
@@ -98,16 +84,14 @@ public static function deleteFile($file)
9884 /**
9985 * Move to Quarantine.
10086 *
101- * @param $file
102- *
10387 * @return string
10488 */
10589 public static function moveToQuarantine ($ file )
10690 {
10791 $ quarantine = Scanner::getPathQuarantine () . DIRECTORY_SEPARATOR . str_replace (realpath (Scanner::getPathScan ()), '' , realpath ($ file ));
10892 $ quarantine = str_replace (['/ ' , '\\' ], DIRECTORY_SEPARATOR , $ quarantine );
10993 if (!is_dir (dirname ($ quarantine )) && (!mkdir ($ concurrentDirectory = dirname ($ quarantine ), 0755 , true ) && !is_dir ($ concurrentDirectory ))) {
110- throw new RuntimeException (sprintf ('Directory "%s" was not created ' , $ concurrentDirectory ));
94+ throw new \ RuntimeException (sprintf ('Directory "%s" was not created ' , $ concurrentDirectory ));
11195 }
11296 rename ($ file , $ quarantine );
11397
@@ -117,8 +101,6 @@ public static function moveToQuarantine($file)
117101 /**
118102 * Move to Quarantine.
119103 *
120- * @param $file
121- *
122104 * @return string
123105 */
124106 public static function makeBackup ($ file )
@@ -129,9 +111,9 @@ public static function makeBackup($file)
129111 }
130112 $ backup = Scanner::getPathBackups () . DIRECTORY_SEPARATOR . str_replace ($ scanPath , '' , realpath ($ file ));
131113 $ backup = Path::get ($ backup );
132- if (!is_dir (dirname ($ backup )) &&
133- (!mkdir ($ concurrentDirectory = dirname ($ backup ), 0755 , true ) && !is_dir ($ concurrentDirectory ))) {
134- throw new RuntimeException (sprintf ('Directory "%s" was not created ' , $ concurrentDirectory ));
114+ if (!is_dir (dirname ($ backup ))
115+ && (!mkdir ($ concurrentDirectory = dirname ($ backup ), 0755 , true ) && !is_dir ($ concurrentDirectory ))) {
116+ throw new \ RuntimeException (sprintf ('Directory "%s" was not created ' , $ concurrentDirectory ));
135117 }
136118 copy ($ file , $ backup );
137119
@@ -141,9 +123,6 @@ public static function makeBackup($file)
141123 /**
142124 * Add to Whitelist.
143125 *
144- * @param $file
145- * @param $patternFound
146- *
147126 * @return false|int
148127 */
149128 public static function addToWhitelist ($ file , $ patternFound )
@@ -175,9 +154,6 @@ public static function addToWhitelist($file, $patternFound)
175154
176155 /**
177156 * Open with VIM.
178- *
179- * @param $file
180- * @param $lineNumber
181157 */
182158 public static function openWithVim ($ file , $ lineNumber = null )
183159 {
@@ -190,7 +166,7 @@ public static function openWithVim($file, $lineNumber = null)
190166 ['file ' , '/dev/tty ' , 'w ' ],
191167 ['file ' , '/dev/tty ' , 'w ' ],
192168 ];
193- $ command = " vim " ;
169+ $ command = ' vim ' ;
194170 if ($ lineNumber !== null && is_numeric ($ lineNumber ) && $ lineNumber > 0 ) {
195171 $ command .= "+ $ lineNumber " ;
196172 }
@@ -206,9 +182,6 @@ public static function openWithVim($file, $lineNumber = null)
206182
207183 /**
208184 * Open with Nano.
209- *
210- * @param $file
211- * @param $lineNumber
212185 */
213186 public static function openWithNano ($ file , $ lineNumber = null )
214187 {
@@ -221,7 +194,7 @@ public static function openWithNano($file, $lineNumber = null)
221194 ['file ' , '/dev/tty ' , 'w ' ],
222195 ['file ' , '/dev/tty ' , 'w ' ],
223196 ];
224- $ command = " nano " ;
197+ $ command = ' nano ' ;
225198 if ($ lineNumber !== null && is_numeric ($ lineNumber ) && $ lineNumber > 0 ) {
226199 $ command .= "+ $ lineNumber " ;
227200 }
@@ -248,16 +221,14 @@ public static function cleanQuarantine()
248221 /**
249222 * Unlink.
250223 *
251- * @param $path
252- *
253224 * @return bool
254225 */
255226 protected static function unlink ($ path )
256227 {
257228 if (is_dir ($ path ) && !is_link ($ path )) {
258- $ files = new RecursiveIteratorIterator (
259- new RecursiveDirectoryIterator ($ path , RecursiveDirectoryIterator::SKIP_DOTS ),
260- RecursiveIteratorIterator::CHILD_FIRST
229+ $ files = new \ RecursiveIteratorIterator (
230+ new \ RecursiveDirectoryIterator ($ path , \ RecursiveDirectoryIterator::SKIP_DOTS ),
231+ \ RecursiveIteratorIterator::CHILD_FIRST
261232 );
262233
263234 foreach ($ files as $ fileinfo ) {
0 commit comments