@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function handleQueue() |
| 16 | 16 | { |
| 17 | 17 | foreach ($this->files as $file) { |
| 18 | - echo get_class()." обрабатывает файл: $file\n"; |
|
| 18 | + echo get_class() . " обрабатывает файл: $file\n"; |
|
| 19 | 19 | } |
| 20 | 20 | // TODO: Implement handleQueue() method. |
| 21 | 21 | } |
@@ -15,14 +15,14 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function canHandleFile($file); |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Записывает файл в очередь на обработку. |
|
| 20 | - * |
|
| 21 | - * @param string $file Путь к файлу |
|
| 22 | - * |
|
| 23 | - * @return void |
|
| 24 | - */ |
|
| 25 | - public function queueFile($file); |
|
| 18 | + /** |
|
| 19 | + * Записывает файл в очередь на обработку. |
|
| 20 | + * |
|
| 21 | + * @param string $file Путь к файлу |
|
| 22 | + * |
|
| 23 | + * @return void |
|
| 24 | + */ |
|
| 25 | + public function queueFile($file); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Обрабатывает файлы в очереди. |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function canHandleFile($file = null) |
| 17 | 17 | { |
| 18 | 18 | if (is_null($file)) { |
| 19 | - throw new \Exception('В обработчик '.get_class()." передано неверное имя файла: $file"); |
|
| 19 | + throw new \Exception('В обработчик ' . get_class() . " передано неверное имя файла: $file"); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function handleQueue() |
| 39 | 39 | { |
| 40 | 40 | foreach ($this->files as $file) { |
| 41 | - echo get_class()." обрабатывает файл: $file\n"; |
|
| 41 | + echo get_class() . " обрабатывает файл: $file\n"; |
|
| 42 | 42 | } |
| 43 | 43 | // TODO: Implement handleQueue() method. |
| 44 | 44 | } |
@@ -6,8 +6,8 @@ |
||
| 6 | 6 | { |
| 7 | 7 | /** @var array Стандартные обработчики */ |
| 8 | 8 | private $defaultHandlers = [ |
| 9 | - 'image' => __NAMESPACE__.'\ImageHandler', |
|
| 10 | - 'css' => __NAMESPACE__.'\CssHandler', |
|
| 9 | + 'image' => __NAMESPACE__ . '\ImageHandler', |
|
| 10 | + 'css' => __NAMESPACE__ . '\CssHandler', |
|
| 11 | 11 | ]; |
| 12 | 12 | |
| 13 | 13 | /** @var array Включенные обработчики */ |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | ], |
| 49 | 49 | ]; |
| 50 | 50 | |
| 51 | - public static function getBinaryHandler($type){ |
|
| 51 | + public static function getBinaryHandler($type) { |
|
| 52 | 52 | |
| 53 | 53 | $handlers = self::getBinaryHandlers(); |
| 54 | 54 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public static function getBinaryHandlers(){ |
|
| 61 | + public static function getBinaryHandlers() { |
|
| 62 | 62 | |
| 63 | 63 | $os = strtolower(PHP_OS); |
| 64 | 64 | if (substr($os, 0, 3) == "win") { |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function __construct($path) |
| 16 | 16 | { |
| 17 | 17 | $basePath = $_SERVER['DOCUMENT_ROOT']; |
| 18 | - $path = $basePath .'/'. trim($path, '\/'); |
|
| 18 | + $path = $basePath . '/' . trim($path, '\/'); |
|
| 19 | 19 | if (empty($path) || !(is_dir($path) || is_file($path)) || !is_writable($path)) { |
| 20 | 20 | throw new Exception('Путь не может быть пустым или нет доступа'); |
| 21 | 21 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function getBinaries(Event $event) |
| 27 | 27 | { |
| 28 | - $dir = self::getRootPath().'/bin'; |
|
| 28 | + $dir = self::getRootPath() . '/bin'; |
|
| 29 | 29 | |
| 30 | 30 | if (!file_exists($dir)) { |
| 31 | 31 | mkdir($dir); |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | foreach (self::$extByPlatforms as $ext) { |
| 37 | 37 | foreach (self::$tools as $tool) { |
| 38 | 38 | file_put_contents( |
| 39 | - $dir.'/'.$tool.$ext, |
|
| 40 | - fopen('https://github.com/nosilver4u/ewww-image-optimizer/raw/master/binaries/'.$tool.$ext, 'r') |
|
| 39 | + $dir . '/' . $tool . $ext, |
|
| 40 | + fopen('https://github.com/nosilver4u/ewww-image-optimizer/raw/master/binaries/' . $tool . $ext, 'r') |
|
| 41 | 41 | ); |
| 42 | - $event->getIO()->write($tool.$ext); |
|
| 42 | + $event->getIO()->write($tool . $ext); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); |
| 34 | 34 | |
| 35 | - if($handlers[$ext]) { |
|
| 35 | + if ($handlers[$ext]) { |
|
| 36 | 36 | |
| 37 | 37 | switch ($ext) { |
| 38 | 38 | case 'png': |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | break; |
| 41 | 41 | case 'jpg': |
| 42 | 42 | case 'jpeg': |
| 43 | - $command = sprintf($this->args[$ext], escapeshellarg($file), escapeshellarg($file . ".original")); |
|
| 43 | + $command = sprintf($this->args[$ext], escapeshellarg($file), escapeshellarg($file . ".original")); |
|
| 44 | 44 | break; |
| 45 | 45 | } |
| 46 | 46 | if (!file_exists($file . ".original") && $command) { |
| 47 | 47 | copy($file, $file . ".original"); |
| 48 | - exec($handlers[$ext] . $command); |
|
| 48 | + exec($handlers[$ext] . $command); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | } else { |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | $output->writeln('<info>BxOptimization set up.</info>'); |
| 44 | 44 | } catch (\Exception $e) { |
| 45 | - $output->writeln('<error>'.get_class($e).': '.$e->getMessage().'</error>'); |
|
| 45 | + $output->writeln('<error>' . get_class($e) . ': ' . $e->getMessage() . '</error>'); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | } |