Conditions | 9 |
Paths | 20 |
Total Lines | 37 |
Code Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function handleQueue() |
||
23 | { |
||
24 | $handlers = []; |
||
25 | foreach ($this->validExt as $ext) { |
||
26 | $handlers[$ext] = HandlerTools::getBinaryHandler($ext); |
||
27 | } |
||
28 | |||
29 | foreach ($this->files as $file) { |
||
30 | |||
31 | $command = false; |
||
32 | |||
33 | $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); |
||
34 | |||
35 | if($handlers[$ext]) { |
||
36 | |||
37 | echo get_class()." обрабатывает файл: $file\n"; |
||
38 | |||
39 | |||
40 | switch ($ext) { |
||
41 | case 'png': |
||
42 | $command = sprintf($this->args[$ext], escapeshellarg($file)); |
||
43 | break; |
||
44 | case 'jpg': |
||
45 | case 'jpeg': |
||
46 | $command = sprintf($this->args[$ext], escapeshellarg($file), escapeshellarg($file . ".original")); |
||
47 | break; |
||
48 | } |
||
49 | if (!file_exists($file . ".original") && $command) { |
||
|
|||
50 | copy($file, $file . ".original"); |
||
51 | exec($handlers[$ext] . $command); |
||
52 | } |
||
53 | |||
54 | } else { |
||
55 | echo "Не найден бинарный обработчик для файла: $file\n"; |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: