@@ -237,8 +237,8 @@ |
||
237 | 237 | if ($code == 0 || $code == 2 || is_null($code)) { |
238 | 238 | // rewrite original file |
239 | 239 | if (rename($this->tmp2, $this->path) !== true) { |
240 | - throw new \RuntimeException(__FILE__ . ', line ' . __LINE__ . |
|
241 | - ': Could not replace original file ' . $this->path); |
|
240 | + throw new \RuntimeException(__FILE__.', line '.__LINE__. |
|
241 | + ': Could not replace original file '.$this->path); |
|
242 | 242 | } |
243 | 243 | } else { |
244 | 244 | throw new \RuntimeException(__FILE__.', line '.__LINE__. |
@@ -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 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $compression = 'lzma2'; |
120 | 120 | break; |
121 | 121 | case 'z': |
122 | - $tar_aname = 'compress.lzw://' . $archiveFileName; |
|
122 | + $tar_aname = 'compress.lzw://'.$archiveFileName; |
|
123 | 123 | break; |
124 | 124 | } |
125 | 125 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | case Formats::TAR_LZW: |
173 | 173 | LzwStreamWrapper::registerWrapper(); |
174 | - $this->tar = new Archive_Tar('compress.lzw://' . $this->archiveFileName); |
|
174 | + $this->tar = new Archive_Tar('compress.lzw://'.$this->archiveFileName); |
|
175 | 175 | break; |
176 | 176 | |
177 | 177 | default: |
@@ -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 | /** |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | $this->files[$file->Location] = $directory.$file->strd_FileId; |
121 | 121 | $this->filesSize += $file->DataLen; |
122 | 122 | |
123 | - $this->filesData[$directory . $file->strd_FileId] = |
|
123 | + $this->filesData[$directory.$file->strd_FileId] = |
|
124 | 124 | [ |
125 | 125 | 'size' => $file->DataLen, |
126 | 126 | 'mtime' => |
127 | - strtotime((string)$file->isoRecDate), |
|
127 | + strtotime((string) $file->isoRecDate), |
|
128 | 128 | ]; |
129 | 129 | } |
130 | 130 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | return false; |
173 | 173 | |
174 | 174 | return new ArchiveEntry($fileName, $this->filesData[$fileName]['size'], |
175 | - $this->filesData[$fileName]['size'], $this->filesData[$fileName]['mtime'],false); |
|
175 | + $this->filesData[$fileName]['size'], $this->filesData[$fileName]['mtime'], false); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -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() |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $fp = fopen($file, 'rb'); |
17 | 17 | if (filesize($file) < 18 || strcmp(fread($fp, 2), "\x1f\x8b")) { |
18 | - return false; // Not GZIP format (See RFC 1952) |
|
18 | + return false; // Not GZIP format (See RFC 1952) |
|
19 | 19 | } |
20 | 20 | $method = fread($fp, 1); |
21 | 21 | $flags = fread($fp, 1); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | */ |
12 | 12 | class Lzma extends OneFileDriver |
13 | 13 | { |
14 | - const FORMAT_SUFFIX = 'xz'; |
|
14 | + const FORMAT_SUFFIX = 'xz'; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @return array |