@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public static function open($fileName, $abilities = [], $password = null) |
| 65 | 65 | { |
| 66 | 66 | if (!file_exists($fileName) || !is_readable($fileName)) { |
| 67 | - throw new InvalidArgumentException('Could not open file: ' . $fileName . ' is not readable'); |
|
| 67 | + throw new InvalidArgumentException('Could not open file: '.$fileName.' is not readable'); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $format = Formats::detectArchiveFormat($fileName); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if ($archiveName !== null) { |
| 113 | 113 | $archiveType = Formats::detectArchiveFormat($archiveName, false); |
| 114 | 114 | if ($archiveType === null) { |
| 115 | - throw new UnsupportedArchiveException('Could not detect archive type for name "' . $archiveName . '"'); |
|
| 115 | + throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"'); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | ) |
| 179 | 179 | { |
| 180 | 180 | if (file_exists($archiveName)) { |
| 181 | - throw new FileAlreadyExistsException('Archive ' . $archiveName . ' already exists!'); |
|
| 181 | + throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!'); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $info = static::prepareForArchiving($fileOrFiles, $archiveName); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $fileProgressCallable = null |
| 230 | 230 | ) |
| 231 | 231 | { |
| 232 | - $info = static::prepareForArchiving($fileOrFiles, '.' . Formats::getFormatExtension($archiveFormat)); |
|
| 232 | + $info = static::prepareForArchiving($fileOrFiles, '.'.Formats::getFormatExtension($archiveFormat)); |
|
| 233 | 233 | try { |
| 234 | 234 | $driver = static::getCreationDriver($archiveFormat, true, $password !== null); |
| 235 | 235 | } catch (UnsupportedArchiveException $e) { |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | protected static function getCreationDriver($archiveFormat, $inString, $encrypted) |
| 254 | 254 | { |
| 255 | 255 | if (!Formats::canCreate($archiveFormat)) { |
| 256 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $archiveFormat); |
|
| 256 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$archiveFormat); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | $abilities = [Abilities::CREATE]; |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | if ($encrypted) { |
| 265 | 265 | if (!Formats::canEncrypt($archiveFormat)) { |
| 266 | - throw new UnsupportedOperationException('Archive type ' . $archiveFormat . ' can not be encrypted'); |
|
| 266 | + throw new UnsupportedOperationException('Archive type '.$archiveFormat.' can not be encrypted'); |
|
| 267 | 267 | } |
| 268 | 268 | $abilities[] = Abilities::CREATE_ENCRYPTED; |
| 269 | 269 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | /** @var BasicDriver $driver */ |
| 272 | 272 | $driver = Formats::getFormatDriver($archiveFormat, $abilities); |
| 273 | 273 | if ($driver === null) { |
| 274 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $archiveFormat . ' of archive '); |
|
| 274 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$archiveFormat.' of archive '); |
|
| 275 | 275 | } |
| 276 | 276 | return $driver; |
| 277 | 277 | } |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | $driver = Formats::getFormatDriver($format, $abilities); |
| 296 | 296 | if ($driver === null) { |
| 297 | 297 | throw new UnsupportedArchiveException( |
| 298 | - 'Format ' . $format . ' driver with abilities (' |
|
| 298 | + 'Format '.$format.' driver with abilities (' |
|
| 299 | 299 | . implode( |
| 300 | 300 | ', ', |
| 301 | - array_map(function ($ability) { |
|
| 301 | + array_map(function($ability) { |
|
| 302 | 302 | return array_search($ability, Abilities::$abilitiesLabels); |
| 303 | 303 | }, $abilities) |
| 304 | 304 | ) |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | public function getFileData($fileName) |
| 493 | 493 | { |
| 494 | 494 | if (!in_array($fileName, $this->files, true)) { |
| 495 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
| 495 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | return $this->archive->getFileData($fileName); |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | public function getFileContent($fileName) |
| 509 | 509 | { |
| 510 | 510 | if (!in_array($fileName, $this->files, true)) { |
| 511 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
| 511 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | return $this->archive->getFileContent($fileName); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | public function getFileStream($fileName) |
| 525 | 525 | { |
| 526 | 526 | if (!in_array($fileName, $this->files, true)) { |
| 527 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
| 527 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | return $this->archive->getFileStream($fileName); |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | $newFiles = []; |
| 660 | 660 | foreach ($files as $file) { |
| 661 | 661 | foreach ($archiveFiles as $archiveFile) { |
| 662 | - if (fnmatch($file . '*', $archiveFile)) { |
|
| 662 | + if (fnmatch($file.'*', $archiveFile)) { |
|
| 663 | 663 | $newFiles[] = $archiveFile; |
| 664 | 664 | } |
| 665 | 665 | } |
@@ -692,8 +692,8 @@ discard block |
||
| 692 | 692 | if (is_array($source)) { |
| 693 | 693 | foreach ($source as $sourceItem) { |
| 694 | 694 | static::importFilesFromDir( |
| 695 | - rtrim($sourceItem, '/\\*') . '/*', |
|
| 696 | - !empty($destination) ? $destination . '/' : null, |
|
| 695 | + rtrim($sourceItem, '/\\*').'/*', |
|
| 696 | + !empty($destination) ? $destination.'/' : null, |
|
| 697 | 697 | true, |
| 698 | 698 | $files |
| 699 | 699 | ); |
@@ -701,8 +701,8 @@ discard block |
||
| 701 | 701 | } else if (is_dir($source)) { |
| 702 | 702 | // one source for directories |
| 703 | 703 | static::importFilesFromDir( |
| 704 | - rtrim($source, '/\\*') . '/*', |
|
| 705 | - !empty($destination) ? $destination . '/' : null, |
|
| 704 | + rtrim($source, '/\\*').'/*', |
|
| 705 | + !empty($destination) ? $destination.'/' : null, |
|
| 706 | 706 | true, |
| 707 | 707 | $files |
| 708 | 708 | ); |
@@ -714,9 +714,9 @@ discard block |
||
| 714 | 714 | } else if (is_string($nodes)) { // passed one file or directory |
| 715 | 715 | // if is directory |
| 716 | 716 | if (is_dir($nodes)) { |
| 717 | - $nodes = rtrim($nodes, '/\\*') . '/'; |
|
| 717 | + $nodes = rtrim($nodes, '/\\*').'/'; |
|
| 718 | 718 | static::importFilesFromDir( |
| 719 | - $nodes . '*', |
|
| 719 | + $nodes.'*', |
|
| 720 | 720 | $nodes, |
| 721 | 721 | true, |
| 722 | 722 | $files |
@@ -745,10 +745,10 @@ discard block |
||
| 745 | 745 | |
| 746 | 746 | foreach (glob($source, GLOB_MARK) as $node) { |
| 747 | 747 | if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) { |
| 748 | - static::importFilesFromDir(str_replace('\\', '/', $node) . '*', |
|
| 749 | - $destination . basename($node) . '/', $recursive, $map); |
|
| 748 | + static::importFilesFromDir(str_replace('\\', '/', $node).'*', |
|
| 749 | + $destination.basename($node).'/', $recursive, $map); |
|
| 750 | 750 | } elseif (is_file($node) && is_readable($node)) { |
| 751 | - $map[$destination . basename($node)] = $node; |
|
| 751 | + $map[$destination.basename($node)] = $node; |
|
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | 754 | } |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
| 968 | 968 | { |
| 969 | 969 | if (!is_file($file)) { |
| 970 | - throw new InvalidArgumentException($file . ' is not a valid file to archive'); |
|
| 970 | + throw new InvalidArgumentException($file.' is not a valid file to archive'); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | return static::create($file, $archiveName, $compressionLevel, $password) === 1; |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
| 989 | 989 | { |
| 990 | 990 | if (!is_dir($directory) || !is_readable($directory)) |
| 991 | - throw new InvalidArgumentException($directory . ' is not a valid directory to archive'); |
|
| 991 | + throw new InvalidArgumentException($directory.' is not a valid directory to archive'); |
|
| 992 | 992 | |
| 993 | 993 | return static::create($directory, $archiveName, $compressionLevel, $password) > 0; |
| 994 | 994 | } |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | public function addFile($file, $inArchiveName = null) |
| 1151 | 1151 | { |
| 1152 | 1152 | if (!is_file($file)) |
| 1153 | - throw new InvalidArgumentException($file . ' is not a valid file to add in archive'); |
|
| 1153 | + throw new InvalidArgumentException($file.' is not a valid file to add in archive'); |
|
| 1154 | 1154 | |
| 1155 | 1155 | return ($inArchiveName !== null |
| 1156 | 1156 | ? $this->add([$inArchiveName => $file]) |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | public function addDirectory($directory, $inArchivePath = null) |
| 1172 | 1172 | { |
| 1173 | 1173 | if (!is_dir($directory) || !is_readable($directory)) |
| 1174 | - throw new InvalidArgumentException($directory . ' is not a valid directory to add in archive'); |
|
| 1174 | + throw new InvalidArgumentException($directory.' is not a valid directory to add in archive'); |
|
| 1175 | 1175 | |
| 1176 | 1176 | return ($inArchivePath !== null |
| 1177 | 1177 | ? $this->add([$inArchivePath => $directory]) |