@@ -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); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | if ($archiveName !== null) { |
122 | 122 | $archiveType = Formats::detectArchiveFormat($archiveName, false); |
123 | 123 | if ($archiveType === false) { |
124 | - throw new UnsupportedArchiveException('Could not detect archive type for name "' . $archiveName . '"'); |
|
124 | + throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"'); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ) |
188 | 188 | { |
189 | 189 | if (file_exists($archiveName)) { |
190 | - throw new FileAlreadyExistsException('Archive ' . $archiveName . ' already exists!'); |
|
190 | + throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!'); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $info = static::prepareForArchiving($fileOrFiles, $archiveName); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $fileProgressCallable = null |
239 | 239 | ) |
240 | 240 | { |
241 | - $info = static::prepareForArchiving($fileOrFiles, '.' . Formats::getFormatExtension($archiveFormat)); |
|
241 | + $info = static::prepareForArchiving($fileOrFiles, '.'.Formats::getFormatExtension($archiveFormat)); |
|
242 | 242 | try { |
243 | 243 | $driver = static::getCreationDriver($archiveFormat, true, $password !== null); |
244 | 244 | } catch (UnsupportedArchiveException $e) { |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | protected static function getCreationDriver($archiveFormat, $inString, $encrypted) |
263 | 263 | { |
264 | 264 | if (!Formats::canCreate($archiveFormat)) { |
265 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $archiveFormat); |
|
265 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$archiveFormat); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | $abilities = [BasicDriver::CREATE]; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | |
273 | 273 | if ($encrypted) { |
274 | 274 | if (!Formats::canEncrypt($archiveFormat)) { |
275 | - throw new UnsupportedOperationException('Archive type ' . $archiveFormat . ' can not be encrypted'); |
|
275 | + throw new UnsupportedOperationException('Archive type '.$archiveFormat.' can not be encrypted'); |
|
276 | 276 | } |
277 | 277 | $abilities[] = BasicDriver::CREATE_ENCRYPTED; |
278 | 278 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | /** @var BasicDriver $driver */ |
281 | 281 | $driver = Formats::getFormatDriver($archiveFormat, $abilities); |
282 | 282 | if ($driver === null) { |
283 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $archiveFormat . ' of archive '); |
|
283 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$archiveFormat.' of archive '); |
|
284 | 284 | } |
285 | 285 | return $driver; |
286 | 286 | } |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | public function getFileData($fileName) |
472 | 472 | { |
473 | 473 | if (!in_array($fileName, $this->files, true)) { |
474 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
474 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | return $this->archive->getFileData($fileName); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | public function getFileContent($fileName) |
488 | 488 | { |
489 | 489 | if (!in_array($fileName, $this->files, true)) { |
490 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
490 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | return $this->archive->getFileContent($fileName); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | public function getFileStream($fileName) |
504 | 504 | { |
505 | 505 | if (!in_array($fileName, $this->files, true)) { |
506 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
506 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | return $this->archive->getFileStream($fileName); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | public function addFile($file, $inArchiveName = null) |
602 | 602 | { |
603 | 603 | if (!is_file($file)) |
604 | - throw new InvalidArgumentException($file . ' is not a valid file to add in archive'); |
|
604 | + throw new InvalidArgumentException($file.' is not a valid file to add in archive'); |
|
605 | 605 | |
606 | 606 | return ($inArchiveName !== null |
607 | 607 | ? $this->add([$inArchiveName => $file]) |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | public function addDirectory($directory, $inArchivePath = null) |
636 | 636 | { |
637 | 637 | if (!is_dir($directory) || !is_readable($directory)) |
638 | - throw new InvalidArgumentException($directory . ' is not a valid directory to add in archive'); |
|
638 | + throw new InvalidArgumentException($directory.' is not a valid directory to add in archive'); |
|
639 | 639 | |
640 | 640 | return ($inArchivePath !== null |
641 | 641 | ? $this->add([$inArchivePath => $directory]) |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | $newFiles = []; |
679 | 679 | foreach ($files as $file) { |
680 | 680 | foreach ($archiveFiles as $archiveFile) { |
681 | - if (fnmatch($file . '*', $archiveFile)) { |
|
681 | + if (fnmatch($file.'*', $archiveFile)) { |
|
682 | 682 | $newFiles[] = $archiveFile; |
683 | 683 | } |
684 | 684 | } |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | if (is_array($source)) { |
714 | 714 | foreach ($source as $sourceItem) { |
715 | 715 | static::importFilesFromDir( |
716 | - rtrim($sourceItem, '/\\*') . '/*', |
|
717 | - !empty($destination) ? $destination . '/' : null, |
|
716 | + rtrim($sourceItem, '/\\*').'/*', |
|
717 | + !empty($destination) ? $destination.'/' : null, |
|
718 | 718 | true, |
719 | 719 | $files |
720 | 720 | ); |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | } else if (is_dir($source)) { |
723 | 723 | // one source for directories |
724 | 724 | static::importFilesFromDir( |
725 | - rtrim($source, '/\\*') . '/*', |
|
726 | - !empty($destination) ? $destination . '/' : null, |
|
725 | + rtrim($source, '/\\*').'/*', |
|
726 | + !empty($destination) ? $destination.'/' : null, |
|
727 | 727 | true, |
728 | 728 | $files |
729 | 729 | ); |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | } else if (is_string($nodes)) { // passed one file or directory |
736 | 736 | // if is directory |
737 | 737 | if (is_dir($nodes)) |
738 | - static::importFilesFromDir(rtrim($nodes, '/\\*') . '/*', null, true, |
|
738 | + static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true, |
|
739 | 739 | $files); |
740 | 740 | else if (is_file($nodes)) |
741 | 741 | $files[basename($nodes)] = $nodes; |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | |
761 | 761 | foreach (glob($source, GLOB_MARK) as $node) { |
762 | 762 | if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) { |
763 | - static::importFilesFromDir(str_replace('\\', '/', $node) . '*', |
|
764 | - $destination . basename($node) . '/', $recursive, $map); |
|
763 | + static::importFilesFromDir(str_replace('\\', '/', $node).'*', |
|
764 | + $destination.basename($node).'/', $recursive, $map); |
|
765 | 765 | } elseif (is_file($node) && is_readable($node)) { |
766 | - $map[$destination . basename($node)] = $node; |
|
766 | + $map[$destination.basename($node)] = $node; |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | } |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
961 | 961 | { |
962 | 962 | if (!is_file($file)) { |
963 | - throw new InvalidArgumentException($file . ' is not a valid file to archive'); |
|
963 | + throw new InvalidArgumentException($file.' is not a valid file to archive'); |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | return static::create($file, $archiveName, $compressionLevel, $password) === 1; |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
982 | 982 | { |
983 | 983 | if (!is_dir($directory) || !is_readable($directory)) |
984 | - throw new InvalidArgumentException($directory . ' is not a valid directory to archive'); |
|
984 | + throw new InvalidArgumentException($directory.' is not a valid directory to archive'); |
|
985 | 985 | |
986 | 986 | return static::create($directory, $archiveName, $compressionLevel, $password) > 0; |
987 | 987 | } |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | |
119 | 119 | $this->files[] = $information->files[] = str_replace('\\', '/', $member->getPath()); |
120 | 120 | $this->members[str_replace('\\', '/', $member->getPath())] = $member; |
121 | - $information->compressedFilesSize += (int)$member->getCompressedSize(); |
|
122 | - $information->uncompressedFilesSize += (int)$member->getSize(); |
|
121 | + $information->compressedFilesSize += (int) $member->getCompressedSize(); |
|
122 | + $information->uncompressedFilesSize += (int) $member->getSize(); |
|
123 | 123 | } |
124 | 124 | return $information; |
125 | 125 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function getFileContent($fileName) |
165 | 165 | { |
166 | - throw new UnsupportedOperationException('Getting file content is not supported by ' . __CLASS__); |
|
166 | + throw new UnsupportedOperationException('Getting file content is not supported by '.__CLASS__); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function getFileStream($fileName) |
174 | 174 | { |
175 | - throw new UnsupportedOperationException('Getting file stream is not supported by ' . __CLASS__); |
|
175 | + throw new UnsupportedOperationException('Getting file stream is not supported by '.__CLASS__); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function extractFiles($outputFolder, array $files) |
183 | 183 | { |
184 | - throw new UnsupportedOperationException('Extract specific files is not supported by ' . __CLASS__); |
|
184 | + throw new UnsupportedOperationException('Extract specific files is not supported by '.__CLASS__); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $fileProgressCallable = null |
216 | 216 | ) { |
217 | 217 | if ($password !== null) { |
218 | - throw new UnsupportedOperationException(__CLASS__ . ' could not encrypt an archive'); |
|
218 | + throw new UnsupportedOperationException(__CLASS__.' could not encrypt an archive'); |
|
219 | 219 | } |
220 | 220 | $archive = static::createArchiveInternal($files, $archiveFileName, $archiveFormat, $compressionLevel, $fileProgressCallable); |
221 | 221 | $archive->save($archiveFileName); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $fileProgressCallable = null |
244 | 244 | ) { |
245 | 245 | if ($password !== null) { |
246 | - throw new UnsupportedOperationException(__CLASS__ . ' could not encrypt an archive'); |
|
246 | + throw new UnsupportedOperationException(__CLASS__.' could not encrypt an archive'); |
|
247 | 247 | } |
248 | 248 | $archive = static::createArchiveInternal($files, null, $archiveFormat, $compressionLevel, $fileProgressCallable); |
249 | 249 | return $archive->getArchive(); |