@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public static function open($fileName, $password = null) |
56 | 56 | { |
57 | 57 | if (!file_exists($fileName) || !is_readable($fileName)) { |
58 | - throw new InvalidArgumentException('Could not open file: ' . $fileName); |
|
58 | + throw new InvalidArgumentException('Could not open file: '.$fileName); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $format = Formats::detectArchiveFormat($fileName); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | public function getFileData($fileName) |
215 | 215 | { |
216 | 216 | if (!in_array($fileName, $this->files, true)) { |
217 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
217 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | return $this->archive->getFileData($fileName); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | public function getFileContent($fileName) |
231 | 231 | { |
232 | 232 | if (!in_array($fileName, $this->files, true)) { |
233 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
233 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | return $this->archive->getFileContent($fileName); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | public function getFileStream($fileName) |
247 | 247 | { |
248 | 248 | if (!in_array($fileName, $this->files, true)) { |
249 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
249 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | return $this->archive->getFileStream($fileName); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
504 | 504 | { |
505 | 505 | if (!is_file($file)) { |
506 | - throw new InvalidArgumentException($file . ' is not a valid file to archive'); |
|
506 | + throw new InvalidArgumentException($file.' is not a valid file to archive'); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | return static::archiveFiles($file, $archiveName, $compressionLevel, $password) === 1; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
535 | - call_user_func(function ($directory) { |
|
535 | + call_user_func(function($directory) { |
|
536 | 536 | foreach (glob($directory.'/*') as $f) { |
537 | 537 | if (is_dir($f)) call_user_func(__FUNCTION__, $f); |
538 | 538 | else unlink($f); |
@@ -561,16 +561,16 @@ discard block |
||
561 | 561 | $filters = array(); |
562 | 562 | if (isset($options[PCLZIP_OPT_REMOVE_PATH]) |
563 | 563 | && !isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) |
564 | - $filters[] = function (&$key, &$value) use ($options) { |
|
564 | + $filters[] = function(&$key, &$value) use ($options) { |
|
565 | 565 | $key = str_replace($key, null, $key); |
566 | 566 | }; |
567 | 567 | if (isset($options[PCLZIP_OPT_REMOVE_ALL_PATH])) |
568 | - $filters[] = function (&$key, &$value) { |
|
568 | + $filters[] = function(&$key, &$value) { |
|
569 | 569 | $key = basename($key); |
570 | 570 | }; |
571 | 571 | if (isset($options[PCLZIP_OPT_ADD_PATH])) |
572 | - $filters[] = function (&$key, &$value) use ($options) { |
|
573 | - $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/') . '/' . |
|
572 | + $filters[] = function(&$key, &$value) use ($options) { |
|
573 | + $key = rtrim($options[PCLZIP_OPT_ADD_PATH], '/').'/'. |
|
574 | 574 | ltrim($key, '/'); |
575 | 575 | }; |
576 | 576 | return $filters; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | */ |
585 | 585 | private function extractCallbacks(array $options, $preCallbackConst, $postCallbackConst) |
586 | 586 | { |
587 | - $preCallback = $postCallback = function () { return true; }; |
|
587 | + $preCallback = $postCallback = function() { return true; }; |
|
588 | 588 | |
589 | 589 | if (isset($options[$preCallbackConst]) && is_callable($options[$preCallbackConst])) |
590 | 590 | $preCallback = $options[$preCallbackConst]; |
@@ -602,8 +602,8 @@ discard block |
||
602 | 602 | private function makeKeyValueArrayFromList(array $options) |
603 | 603 | { |
604 | 604 | return array_combine( |
605 | - array_filter($options, function ($v) {return (bool) $v&2;}), |
|
606 | - array_filter($options, function ($v) {return (bool) ($v-1)&2;}) |
|
605 | + array_filter($options, function($v) {return (bool) $v & 2; }), |
|
606 | + array_filter($options, function($v) {return (bool) ($v - 1) & 2; }) |
|
607 | 607 | ); |
608 | 608 | } |
609 | 609 | |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | range($parts[0], $parts[1]), $allowedIndexes); |
652 | 652 | } |
653 | 653 | |
654 | - return function ($key, $value, $index) use ($allowedIndexes) { |
|
654 | + return function($key, $value, $index) use ($allowedIndexes) { |
|
655 | 655 | return in_array($index, $allowedIndexes) |
656 | 656 | ? self::SELECT_FILTER_PASS |
657 | 657 | : self::SELECT_FILTER_REFUSE; |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | ? $names |
669 | 669 | : explode(',', $names); |
670 | 670 | |
671 | - return function ($key, $value) use ($allowedNames) { |
|
671 | + return function($key, $value) use ($allowedNames) { |
|
672 | 672 | foreach ($allowedNames as $name) { |
673 | 673 | // select directory with nested files |
674 | 674 | if (in_array(substr($name, -1), ['/', '\\'])) { |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | */ |
697 | 697 | protected function createByEregSelector($regex) |
698 | 698 | { |
699 | - return function ($key, $value) use ($regex) { |
|
699 | + return function($key, $value) use ($regex) { |
|
700 | 700 | return (ereg($regex, $key) !== false) |
701 | 701 | ? self::SELECT_FILTER_PASS |
702 | 702 | : self::SELECT_FILTER_REFUSE; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | protected function createByPregSelector($regex) |
711 | 711 | { |
712 | - return function ($key, $value) use ($regex) { |
|
712 | + return function($key, $value) use ($regex) { |
|
713 | 713 | return preg_match($regex, $key) |
714 | 714 | ? self::SELECT_FILTER_PASS |
715 | 715 | : self::SELECT_FILTER_REFUSE; |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $selectFilter = $this->createByIndexSelector($options[PCLZIP_OPT_BY_INDEX]); |
737 | 737 | // no rule |
738 | 738 | else |
739 | - $selectFilter = function () { |
|
739 | + $selectFilter = function() { |
|
740 | 740 | return self::SELECT_FILTER_PASS; |
741 | 741 | }; |
742 | 742 | return $selectFilter; |
@@ -776,9 +776,9 @@ discard block |
||
776 | 776 | if (isset($options[PCLZIP_OPT_COMMENT])) |
777 | 777 | $comment = $options[PCLZIP_OPT_COMMENT]; |
778 | 778 | else if (isset($options[PCLZIP_OPT_ADD_COMMENT])) {; |
779 | - $comment = $currentComment . $options[PCLZIP_OPT_ADD_COMMENT]; |
|
779 | + $comment = $currentComment.$options[PCLZIP_OPT_ADD_COMMENT]; |
|
780 | 780 | } else if (isset($options[PCLZIP_OPT_PREPEND_COMMENT])) { |
781 | - $comment = $options[PCLZIP_OPT_PREPEND_COMMENT] . $currentComment; |
|
781 | + $comment = $options[PCLZIP_OPT_PREPEND_COMMENT].$currentComment; |
|
782 | 782 | } |
783 | 783 | return $comment; |
784 | 784 | } |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | |
195 | 195 | $this->files[] = $information->files[] = str_replace('\\', '/', $member->getLocation()); |
196 | 196 | $this->members[str_replace('\\', '/', $member->getLocation())] = $member; |
197 | - $information->compressedFilesSize += (int)$member->getSize(); |
|
198 | - $information->uncompressedFilesSize += (int)$member->getSize(); |
|
197 | + $information->compressedFilesSize += (int) $member->getSize(); |
|
198 | + $information->uncompressedFilesSize += (int) $member->getSize(); |
|
199 | 199 | } |
200 | 200 | return $information; |
201 | 201 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | public function getFileContent($fileName) |
245 | 245 | { |
246 | 246 | $member = $this->getMember($fileName); |
247 | - return (string)$member; |
|
247 | + return (string) $member; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | public function getFileStream($fileName) |
254 | 254 | { |
255 | 255 | $member = $this->getMember($fileName); |
256 | - return self::wrapStringInStream((string)$member); |
|
256 | + return self::wrapStringInStream((string) $member); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | public static function getDescription() |
49 | 49 | { |
50 | - return 'adapter for ext-zip'.(extension_loaded('zip') && defined('\ZipArchive::LIBZIP_VERSION') ? ' ('. ZipArchive::LIBZIP_VERSION.')' : null); |
|
50 | + return 'adapter for ext-zip'.(extension_loaded('zip') && defined('\ZipArchive::LIBZIP_VERSION') ? ' ('.ZipArchive::LIBZIP_VERSION.')' : null); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public static function getInstallationInstruction() |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function checkFormats() |
32 | 32 | { |
33 | 33 | echo "format\topen\tstream\tcreate\tappend\tupdate\tencrypt\tdrivers".PHP_EOL; |
34 | - foreach(Formats::getFormatsReport() as $format => $config) { |
|
34 | + foreach (Formats::getFormatsReport() as $format => $config) { |
|
35 | 35 | echo $format."\t" |
36 | 36 | .($config['open'] ? '+' : '-')."\t" |
37 | 37 | .($config['stream'] ? '+' : '-')."\t" |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | if (!empty($install)) { |
56 | 56 | $notInstalled[] = [$driverClass, $description, $install]; |
57 | 57 | } else { |
58 | - echo ($i++) . '. ' . $driverClass . ' - ' . $description . PHP_EOL; |
|
58 | + echo ($i++).'. '.$driverClass.' - '.$description.PHP_EOL; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | echo PHP_EOL.'Not installed:'.PHP_EOL; |
64 | 64 | $i = 1; |
65 | 65 | foreach ($notInstalled as $data) { |
66 | - echo ($i++) . '. ' . $data[0] . ' - ' . $data[1] . PHP_EOL |
|
67 | - . '- ' . $data[2] . PHP_EOL.PHP_EOL; |
|
66 | + echo ($i++).'. '.$data[0].' - '.$data[1].PHP_EOL |
|
67 | + . '- '.$data[2].PHP_EOL.PHP_EOL; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | else { |
299 | 299 | $size = $this->formatSize($len); |
300 | 300 | echo sprintf('Added %s(%1.1f%s) file to %s', |
301 | - $args['FILE_IN_ARCHIVE'], $size[0], $size[1], $args['ARCHIVE']) . PHP_EOL; |
|
301 | + $args['FILE_IN_ARCHIVE'], $size[0], $size[1], $args['ARCHIVE']).PHP_EOL; |
|
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | if ($archived_files === false) |
333 | 333 | echo 'Error'.PHP_EOL; |
334 | 334 | else |
335 | - echo 'Created archive ' . $args['ARCHIVE'] . ' with ' . $archived_files . ' file(s) of total size ' . implode('', $this->formatSize(filesize($args['ARCHIVE']))) . PHP_EOL; |
|
335 | + echo 'Created archive '.$args['ARCHIVE'].' with '.$archived_files.' file(s) of total size '.implode('', $this->formatSize(filesize($args['ARCHIVE']))).PHP_EOL; |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 |