Conditions | 7 |
Paths | 12 |
Total Lines | 27 |
Code Lines | 18 |
Lines | 6 |
Ratio | 22.22 % |
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 | $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); |
||
32 | |||
33 | if($handlers[$ext]) { |
||
34 | echo get_class()." обрабатывает файл: $file\n"; |
||
35 | switch ($ext) { |
||
36 | View Code Duplication | case 'png': |
|
|
|||
37 | exec($handlers[$ext] . ' ' . $this->args[$ext] . ' ' . escapeshellarg($file)); |
||
38 | break; |
||
39 | case 'jpg': |
||
40 | View Code Duplication | case 'jpeg': |
|
41 | exec($handlers[$ext] . ' ' . $this->args[$ext] . ' ' . escapeshellarg($file) . ' ' . escapeshellarg($file)); |
||
42 | break; |
||
43 | } |
||
44 | } else { |
||
45 | echo "Не найден бинарный обработчик для файла: $file\n"; |
||
46 | } |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.