@@ -129,7 +129,7 @@ |
||
129 | 129 | ) { |
130 | 130 | $format_extension = Formats::getFormatExtension($archiveFormat); |
131 | 131 | do { |
132 | - $temp_file = tempnam(sys_get_temp_dir(), 'temp_archive') . '.' . $format_extension; |
|
132 | + $temp_file = tempnam(sys_get_temp_dir(), 'temp_archive').'.'.$format_extension; |
|
133 | 133 | } while (file_exists($temp_file)); |
134 | 134 | |
135 | 135 | $created = static::createArchive($files, $temp_file, $archiveFormat, $compressionLevel, $password, $fileProgressCallable); |
@@ -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 | |
@@ -183,17 +183,17 @@ discard block |
||
183 | 183 | ) |
184 | 184 | { |
185 | 185 | if (file_exists($archiveName)) |
186 | - throw new FileAlreadyExistsException('Archive ' . $archiveName . ' already exists!'); |
|
186 | + throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!'); |
|
187 | 187 | |
188 | 188 | $info = static::prepareForArchiving($fileOrFiles, $archiveName); |
189 | 189 | |
190 | 190 | $abilities = [BasicDriver::CREATE]; |
191 | 191 | |
192 | 192 | if (!Formats::canCreate($info['type'])) |
193 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive ' . $archiveName); |
|
193 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName); |
|
194 | 194 | |
195 | 195 | if ($password !== null && !Formats::canEncrypt($info['type'])) |
196 | - throw new UnsupportedOperationException('Archive type ' . $info['type'] . ' can not be encrypted'); |
|
196 | + throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted'); |
|
197 | 197 | if ($password !== null) { |
198 | 198 | $abilities[] = BasicDriver::CREATE_ENCRYPTED; |
199 | 199 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | /** @var BasicDriver $driver */ |
202 | 202 | $driver = Formats::getFormatDriver($info['type'], $abilities); |
203 | 203 | if ($driver === null) { |
204 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive '); |
|
204 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $driver::createArchive( |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | $info = static::prepareForArchiving($fileOrFiles); |
254 | 254 | $abilities = [BasicDriver::CREATE, BasicDriver::CREATE_IN_STRING]; |
255 | 255 | if (!Formats::canCreate($info['type'])) { |
256 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive ' . $archiveName); |
|
256 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | if ($password !== null && !Formats::canEncrypt($info['type'])) { |
260 | - throw new UnsupportedOperationException('Archive type ' . $info['type'] . ' can not be encrypted'); |
|
260 | + throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted'); |
|
261 | 261 | } |
262 | 262 | if ($password !== null) { |
263 | 263 | $abilities[] = BasicDriver::CREATE_ENCRYPTED; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | /** @var BasicDriver $driver */ |
267 | 267 | $driver = Formats::getFormatDriver($info['type'], $abilities); |
268 | 268 | if ($driver === null) { |
269 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive '); |
|
269 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | return $driver::createArchiveInString( |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
293 | 293 | { |
294 | 294 | if (!is_file($file)) { |
295 | - throw new InvalidArgumentException($file . ' is not a valid file to archive'); |
|
295 | + throw new InvalidArgumentException($file.' is not a valid file to archive'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | return static::archive($file, $archiveName, $compressionLevel, $password) === 1; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
313 | 313 | { |
314 | 314 | if (!is_dir($directory) || !is_readable($directory)) |
315 | - throw new InvalidArgumentException($directory . ' is not a valid directory to archive'); |
|
315 | + throw new InvalidArgumentException($directory.' is not a valid directory to archive'); |
|
316 | 316 | |
317 | 317 | return static::archive($directory, $archiveName, $compressionLevel, $password) > 0; |
318 | 318 | } |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | public function getFileData($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->getFileData($fileName); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | public function getFileContent($fileName) |
520 | 520 | { |
521 | 521 | if (!in_array($fileName, $this->files, true)) { |
522 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
522 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | return $this->archive->getFileContent($fileName); |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | public function getFileStream($fileName) |
536 | 536 | { |
537 | 537 | if (!in_array($fileName, $this->files, true)) { |
538 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
538 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | return $this->archive->getFileStream($fileName); |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | public function addFile($file, $inArchiveName = null) |
634 | 634 | { |
635 | 635 | if (!is_file($file)) |
636 | - throw new InvalidArgumentException($file . ' is not a valid file to add in archive'); |
|
636 | + throw new InvalidArgumentException($file.' is not a valid file to add in archive'); |
|
637 | 637 | |
638 | 638 | return ($inArchiveName !== null |
639 | 639 | ? $this->add([$inArchiveName => $file]) |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | public function addDirectory($directory, $inArchivePath = null) |
668 | 668 | { |
669 | 669 | if (!is_dir($directory) || !is_readable($directory)) |
670 | - throw new InvalidArgumentException($directory . ' is not a valid directory to add in archive'); |
|
670 | + throw new InvalidArgumentException($directory.' is not a valid directory to add in archive'); |
|
671 | 671 | |
672 | 672 | return ($inArchivePath !== null |
673 | 673 | ? $this->add([$inArchivePath => $directory]) |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | $newFiles = []; |
711 | 711 | foreach ($files as $file) { |
712 | 712 | foreach ($archiveFiles as $archiveFile) { |
713 | - if (fnmatch($file . '*', $archiveFile)) { |
|
713 | + if (fnmatch($file.'*', $archiveFile)) { |
|
714 | 714 | $newFiles[] = $archiveFile; |
715 | 715 | } |
716 | 716 | } |
@@ -745,8 +745,8 @@ discard block |
||
745 | 745 | if (is_array($source)) { |
746 | 746 | foreach ($source as $sourceItem) { |
747 | 747 | static::importFilesFromDir( |
748 | - rtrim($sourceItem, '/\\*') . '/*', |
|
749 | - !empty($destination) ? $destination . '/' : null, |
|
748 | + rtrim($sourceItem, '/\\*').'/*', |
|
749 | + !empty($destination) ? $destination.'/' : null, |
|
750 | 750 | true, |
751 | 751 | $files |
752 | 752 | ); |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | } else if (is_dir($source)) { |
755 | 755 | // one source for directories |
756 | 756 | static::importFilesFromDir( |
757 | - rtrim($source, '/\\*') . '/*', |
|
758 | - !empty($destination) ? $destination . '/' : null, |
|
757 | + rtrim($source, '/\\*').'/*', |
|
758 | + !empty($destination) ? $destination.'/' : null, |
|
759 | 759 | true, |
760 | 760 | $files |
761 | 761 | ); |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | } else if (is_string($nodes)) { // passed one file or directory |
768 | 768 | // if is directory |
769 | 769 | if (is_dir($nodes)) |
770 | - static::importFilesFromDir(rtrim($nodes, '/\\*') . '/*', null, true, |
|
770 | + static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true, |
|
771 | 771 | $files); |
772 | 772 | else if (is_file($nodes)) |
773 | 773 | $files[basename($nodes)] = $nodes; |
@@ -792,10 +792,10 @@ discard block |
||
792 | 792 | |
793 | 793 | foreach (glob($source, GLOB_MARK) as $node) { |
794 | 794 | if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) { |
795 | - static::importFilesFromDir(str_replace('\\', '/', $node) . '*', |
|
796 | - $destination . basename($node) . '/', $recursive, $map); |
|
795 | + static::importFilesFromDir(str_replace('\\', '/', $node).'*', |
|
796 | + $destination.basename($node).'/', $recursive, $map); |
|
797 | 797 | } elseif (is_file($node) && is_readable($node)) { |
798 | - $map[$destination . basename($node)] = $node; |
|
798 | + $map[$destination.basename($node)] = $node; |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | } |