@@ -43,8 +43,9 @@ |
||
43 | 43 | $this->compressedSize = $compressedSize; |
44 | 44 | $this->uncompressedSize = $uncompressedSize; |
45 | 45 | $this->modificationTime = $modificationTime; |
46 | - if ($isCompressed === null) |
|
47 | - $isCompressed = $uncompressedSize !== $compressedSize; |
|
46 | + if ($isCompressed === null) { |
|
47 | + $isCompressed = $uncompressedSize !== $compressedSize; |
|
48 | + } |
|
48 | 49 | $this->isCompressed = $isCompressed; |
49 | 50 | $this->comment = $comment; |
50 | 51 | } |
@@ -158,8 +158,9 @@ discard block |
||
158 | 158 | // by file content |
159 | 159 | if ($contentCheck) { |
160 | 160 | $mime_type = mime_content_type($fileName); |
161 | - if (isset(static::$mimeTypes[$mime_type])) |
|
162 | - return static::$mimeTypes[$mime_type]; |
|
161 | + if (isset(static::$mimeTypes[$mime_type])) { |
|
162 | + return static::$mimeTypes[$mime_type]; |
|
163 | + } |
|
163 | 164 | } |
164 | 165 | |
165 | 166 | return false; |
@@ -251,12 +252,14 @@ discard block |
||
251 | 252 | protected static function checkFormatSupport($format, $function) |
252 | 253 | { |
253 | 254 | static::retrieveAllFormats(); |
254 | - if (!static::canOpen($format)) |
|
255 | - return false; |
|
255 | + if (!static::canOpen($format)) { |
|
256 | + return false; |
|
257 | + } |
|
256 | 258 | |
257 | 259 | foreach (static::$formatsSupport[$format] as $driver) { |
258 | - if ($driver::$function($format)) |
|
259 | - return true; |
|
260 | + if ($driver::$function($format)) { |
|
261 | + return true; |
|
262 | + } |
|
260 | 263 | } |
261 | 264 | |
262 | 265 | return false; |
@@ -271,15 +274,18 @@ discard block |
||
271 | 274 | { |
272 | 275 | static::retrieveAllFormats(); |
273 | 276 | |
274 | - if (!static::canOpen($format)) |
|
275 | - throw new UnsupportedArchiveException('Unsupported archive type: '.$format.' of archive '); |
|
277 | + if (!static::canOpen($format)) { |
|
278 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$format.' of archive '); |
|
279 | + } |
|
276 | 280 | |
277 | - if (!$createAbility) |
|
278 | - return static::$formatsSupport[$format][0]; |
|
281 | + if (!$createAbility) { |
|
282 | + return static::$formatsSupport[$format][0]; |
|
283 | + } |
|
279 | 284 | |
280 | 285 | foreach (static::$formatsSupport[$format] as $driver) { |
281 | - if ($driver::canCreateArchive($format)) |
|
282 | - return $driver; |
|
286 | + if ($driver::canCreateArchive($format)) { |
|
287 | + return $driver; |
|
288 | + } |
|
283 | 289 | } |
284 | 290 | |
285 | 291 | return false; |
@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | public static function checkFormatSupport($format) |
58 | 58 | { |
59 | 59 | $availability = class_exists('\Archive_Tar'); |
60 | - if (!$availability) return false; |
|
60 | + if (!$availability) { |
|
61 | + return false; |
|
62 | + } |
|
61 | 63 | switch ($format) { |
62 | 64 | case Formats::TAR: |
63 | 65 | return true; |
@@ -140,10 +142,11 @@ discard block |
||
140 | 142 | break; |
141 | 143 | } |
142 | 144 | |
143 | - if (isset($tar_aname)) |
|
144 | - $tar = new Archive_Tar($tar_aname, $compression); |
|
145 | - else |
|
146 | - $tar = new Archive_Tar($archiveFileName, $compression); |
|
145 | + if (isset($tar_aname)) { |
|
146 | + $tar = new Archive_Tar($tar_aname, $compression); |
|
147 | + } else { |
|
148 | + $tar = new Archive_Tar($archiveFileName, $compression); |
|
149 | + } |
|
147 | 150 | |
148 | 151 | $current_file = 0; |
149 | 152 | $total_files = count($files); |
@@ -152,11 +155,13 @@ discard block |
||
152 | 155 | $add_dir = dirname($localName); |
153 | 156 | |
154 | 157 | if (is_null($filename)) { |
155 | - if ($tar->addString($localName, '') === false) |
|
156 | - throw new ArchiveCreationException('Error when adding directory '.$localName.' to archive'); |
|
158 | + if ($tar->addString($localName, '') === false) { |
|
159 | + throw new ArchiveCreationException('Error when adding directory '.$localName.' to archive'); |
|
160 | + } |
|
157 | 161 | } else { |
158 | - if ($tar->addModify($filename, $add_dir, $remove_dir) === false) |
|
159 | - throw new ArchiveCreationException('Error when adding file '.$filename.' to archive'); |
|
162 | + if ($tar->addModify($filename, $add_dir, $remove_dir) === false) { |
|
163 | + throw new ArchiveCreationException('Error when adding file '.$filename.' to archive'); |
|
164 | + } |
|
160 | 165 | } |
161 | 166 | if ($fileProgressCallable !== null) { |
162 | 167 | call_user_func_array($fileProgressCallable, [$current_file++, $total_files, $filename, $localName]); |
@@ -216,8 +221,9 @@ discard block |
||
216 | 221 | continue; |
217 | 222 | } |
218 | 223 | // skip directories |
219 | - if ($file['typeflag'] == '5' || substr($file['filename'], -1) === '/') |
|
220 | - continue; |
|
224 | + if ($file['typeflag'] == '5' || substr($file['filename'], -1) === '/') { |
|
225 | + continue; |
|
226 | + } |
|
221 | 227 | $information->files[] = $file['filename']; |
222 | 228 | $information->uncompressedFilesSize += $file['size']; |
223 | 229 | $this->pearFilesIndex[$file['filename']] = $i; |
@@ -262,14 +268,16 @@ discard block |
||
262 | 268 | */ |
263 | 269 | public function getFileData($fileName) |
264 | 270 | { |
265 | - if (!isset($this->pearFilesIndex[$fileName])) |
|
266 | - throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list'); |
|
271 | + if (!isset($this->pearFilesIndex[$fileName])) { |
|
272 | + throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list'); |
|
273 | + } |
|
267 | 274 | |
268 | 275 | $index = $this->pearFilesIndex[$fileName]; |
269 | 276 | |
270 | 277 | $files_list = $this->tar->listContent(); |
271 | - if (!isset($files_list[$index])) |
|
272 | - throw new NonExistentArchiveFileException('File '.$fileName.' is not found in Tar archive'); |
|
278 | + if (!isset($files_list[$index])) { |
|
279 | + throw new NonExistentArchiveFileException('File '.$fileName.' is not found in Tar archive'); |
|
280 | + } |
|
273 | 281 | |
274 | 282 | $data = $files_list[$index]; |
275 | 283 | unset($files_list); |
@@ -284,8 +292,9 @@ discard block |
||
284 | 292 | */ |
285 | 293 | public function getFileContent($fileName) |
286 | 294 | { |
287 | - if (!isset($this->pearFilesIndex[$fileName])) |
|
288 | - throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list'); |
|
295 | + if (!isset($this->pearFilesIndex[$fileName])) { |
|
296 | + throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list'); |
|
297 | + } |
|
289 | 298 | |
290 | 299 | return $this->tar->extractInString($fileName); |
291 | 300 | } |
@@ -295,8 +304,9 @@ discard block |
||
295 | 304 | */ |
296 | 305 | public function getFileStream($fileName) |
297 | 306 | { |
298 | - if (!isset($this->pearFilesIndex[$fileName])) |
|
299 | - throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list'); |
|
307 | + if (!isset($this->pearFilesIndex[$fileName])) { |
|
308 | + throw new NonExistentArchiveFileException('File '.$fileName.' is not found in archive files list'); |
|
309 | + } |
|
300 | 310 | |
301 | 311 | return self::wrapStringInStream($this->tar->extractInString($fileName)); |
302 | 312 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public static function getInstallationInstruction() |
91 | 91 | { |
92 | 92 | return !class_exists('\Archive_Tar') |
93 | - ? 'install library [pear/archive_tar]: `composer require pear/archive_tar`' . "\n" . ' and optionally php-extensions (zlib, bzip2)' |
|
93 | + ? 'install library [pear/archive_tar]: `composer require pear/archive_tar`'."\n".' and optionally php-extensions (zlib, bzip2)' |
|
94 | 94 | : null; |
95 | 95 | } |
96 | 96 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $compression = 'lzma2'; |
137 | 137 | break; |
138 | 138 | case 'z': |
139 | - $tar_aname = 'compress.lzw://' . $archiveFileName; |
|
139 | + $tar_aname = 'compress.lzw://'.$archiveFileName; |
|
140 | 140 | break; |
141 | 141 | } |
142 | 142 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | case Formats::TAR_LZW: |
195 | 195 | LzwStreamWrapper::registerWrapper(); |
196 | - $this->tar = new Archive_Tar('compress.lzw://' . $this->archiveFileName); |
|
196 | + $this->tar = new Archive_Tar('compress.lzw://'.$this->archiveFileName); |
|
197 | 197 | break; |
198 | 198 | |
199 | 199 | default: |
@@ -24,10 +24,12 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct($archiveFileName, $format, $password = null) |
26 | 26 | { |
27 | - if (static::FORMAT_SUFFIX === null) |
|
28 | - throw new \Exception('Format should be initialized'); |
|
29 | - if ($password !== null) |
|
30 | - throw new UnsupportedOperationException(self::FORMAT_SUFFIX.' archive does not support password!'); |
|
27 | + if (static::FORMAT_SUFFIX === null) { |
|
28 | + throw new \Exception('Format should be initialized'); |
|
29 | + } |
|
30 | + if ($password !== null) { |
|
31 | + throw new UnsupportedOperationException(self::FORMAT_SUFFIX.' archive does not support password!'); |
|
32 | + } |
|
31 | 33 | |
32 | 34 | $this->fileName = $archiveFileName; |
33 | 35 | $this->inArchiveFileName = basename($archiveFileName, '.'.static::FORMAT_SUFFIX); |
@@ -95,8 +97,9 @@ discard block |
||
95 | 97 | public function extractArchive($outputFolder) |
96 | 98 | { |
97 | 99 | $data = $this->getFileContent($this->inArchiveFileName); |
98 | - if ($data === false) |
|
99 | - throw new ArchiveExtractionException('Could not extract archive'); |
|
100 | + if ($data === false) { |
|
101 | + throw new ArchiveExtractionException('Could not extract archive'); |
|
102 | + } |
|
100 | 103 | |
101 | 104 | $size = strlen($data); |
102 | 105 | $written = file_put_contents($outputFolder.$this->inArchiveFileName, $data); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public static function open($fileName, $password = null) |
63 | 63 | { |
64 | 64 | if (!file_exists($fileName) || !is_readable($fileName)) { |
65 | - throw new InvalidArgumentException('Could not open file: ' . $fileName.' is not readable'); |
|
65 | + throw new InvalidArgumentException('Could not open file: '.$fileName.' is not readable'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $format = Formats::detectArchiveFormat($fileName); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | public function getFileData($fileName) |
273 | 273 | { |
274 | 274 | if (!in_array($fileName, $this->files, true)) { |
275 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
275 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | return $this->archive->getFileData($fileName); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | public function getFileContent($fileName) |
289 | 289 | { |
290 | 290 | if (!in_array($fileName, $this->files, true)) { |
291 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
291 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | return $this->archive->getFileContent($fileName); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | public function getFileStream($fileName) |
305 | 305 | { |
306 | 306 | if (!in_array($fileName, $this->files, true)) { |
307 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
307 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | return $this->archive->getFileStream($fileName); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
560 | 560 | { |
561 | 561 | if (!is_file($file)) { |
562 | - throw new InvalidArgumentException($file . ' is not a valid file to archive'); |
|
562 | + throw new InvalidArgumentException($file.' is not a valid file to archive'); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | return static::archiveFiles($file, $archiveName, $compressionLevel, $password) === 1; |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | if (is_array($source)) { |
631 | 631 | foreach ($source as $sourceItem) { |
632 | 632 | static::importFilesFromDir( |
633 | - rtrim($sourceItem, '/\\*') . '/*', |
|
634 | - !empty($destination) ? $destination . '/' : null, |
|
633 | + rtrim($sourceItem, '/\\*').'/*', |
|
634 | + !empty($destination) ? $destination.'/' : null, |
|
635 | 635 | true, |
636 | 636 | $files |
637 | 637 | ); |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | } else if (is_dir($source)) { |
640 | 640 | // one source for directories |
641 | 641 | static::importFilesFromDir( |
642 | - rtrim($source, '/\\*') . '/*', |
|
643 | - !empty($destination) ? $destination . '/' : null, |
|
642 | + rtrim($source, '/\\*').'/*', |
|
643 | + !empty($destination) ? $destination.'/' : null, |
|
644 | 644 | true, |
645 | 645 | $files |
646 | 646 | ); |
@@ -251,13 +251,15 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function getFileNames($filter = null) |
253 | 253 | { |
254 | - if ($filter === null) |
|
255 | - return $this->files; |
|
254 | + if ($filter === null) { |
|
255 | + return $this->files; |
|
256 | + } |
|
256 | 257 | |
257 | 258 | $result = []; |
258 | 259 | foreach ($this->files as $file) { |
259 | - if (fnmatch($filter, $file)) |
|
260 | - $result[] = $file; |
|
260 | + if (fnmatch($filter, $file)) { |
|
261 | + $result[] = $file; |
|
262 | + } |
|
261 | 263 | } |
262 | 264 | return $result; |
263 | 265 | } |
@@ -384,8 +386,9 @@ discard block |
||
384 | 386 | { |
385 | 387 | $files_list = static::createFilesList($fileOrFiles); |
386 | 388 | |
387 | - if (empty($files_list)) |
|
388 | - throw new EmptyFileListException('Files list is empty!'); |
|
389 | + if (empty($files_list)) { |
|
390 | + throw new EmptyFileListException('Files list is empty!'); |
|
391 | + } |
|
389 | 392 | |
390 | 393 | $result = $this->archive->addFiles($files_list); |
391 | 394 | $this->scanArchive(); |
@@ -404,8 +407,9 @@ discard block |
||
404 | 407 | */ |
405 | 408 | public function addFile($file, $inArchiveName = null) |
406 | 409 | { |
407 | - if (!is_file($file)) |
|
408 | - throw new InvalidArgumentException($file.' is not a valid file to add in archive'); |
|
410 | + if (!is_file($file)) { |
|
411 | + throw new InvalidArgumentException($file.' is not a valid file to add in archive'); |
|
412 | + } |
|
409 | 413 | |
410 | 414 | return ($inArchiveName !== null |
411 | 415 | ? $this->addFiles([$inArchiveName => $file]) |
@@ -438,8 +442,9 @@ discard block |
||
438 | 442 | */ |
439 | 443 | public function addDirectory($directory, $inArchivePath = null) |
440 | 444 | { |
441 | - if (!is_dir($directory) || !is_readable($directory)) |
|
442 | - throw new InvalidArgumentException($directory.' is not a valid directory to add in archive'); |
|
445 | + if (!is_dir($directory) || !is_readable($directory)) { |
|
446 | + throw new InvalidArgumentException($directory.' is not a valid directory to add in archive'); |
|
447 | + } |
|
443 | 448 | |
444 | 449 | return ($inArchivePath !== null |
445 | 450 | ? $this->addFiles([$inArchivePath => $directory]) |
@@ -463,13 +468,15 @@ discard block |
||
463 | 468 | { |
464 | 469 | $archiveType = Formats::detectArchiveFormat($archiveName, false); |
465 | 470 | |
466 | - if ($archiveType === false) |
|
467 | - throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"'); |
|
471 | + if ($archiveType === false) { |
|
472 | + throw new UnsupportedArchiveException('Could not detect archive type for name "'.$archiveName.'"'); |
|
473 | + } |
|
468 | 474 | |
469 | 475 | $files_list = static::createFilesList($fileOrFiles); |
470 | 476 | |
471 | - if (empty($files_list)) |
|
472 | - throw new EmptyFileListException('Files list is empty!'); |
|
477 | + if (empty($files_list)) { |
|
478 | + throw new EmptyFileListException('Files list is empty!'); |
|
479 | + } |
|
473 | 480 | |
474 | 481 | $totalSize = 0; |
475 | 482 | foreach ($files_list as $fn) { |
@@ -521,16 +528,19 @@ discard block |
||
521 | 528 | $fileProgressCallable = null |
522 | 529 | ) |
523 | 530 | { |
524 | - if (file_exists($archiveName)) |
|
525 | - throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!'); |
|
531 | + if (file_exists($archiveName)) { |
|
532 | + throw new FileAlreadyExistsException('Archive '.$archiveName.' already exists!'); |
|
533 | + } |
|
526 | 534 | |
527 | 535 | $info = static::prepareForArchiving($fileOrFiles, $archiveName); |
528 | 536 | |
529 | - if (!Formats::canCreate($info['type'])) |
|
530 | - throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName); |
|
537 | + if (!Formats::canCreate($info['type'])) { |
|
538 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '.$archiveName); |
|
539 | + } |
|
531 | 540 | |
532 | - if ($password !== null && !Formats::canEncrypt($info['type'])) |
|
533 | - throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted'); |
|
541 | + if ($password !== null && !Formats::canEncrypt($info['type'])) { |
|
542 | + throw new UnsupportedOperationException('Archive type '.$info['type'].' can not be encrypted'); |
|
543 | + } |
|
534 | 544 | |
535 | 545 | /** @var BasicDriver $driver */ |
536 | 546 | $driver = Formats::getFormatDriver($info['type'], true); |
@@ -578,8 +588,9 @@ discard block |
||
578 | 588 | */ |
579 | 589 | public static function archiveDirectory($directory, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
580 | 590 | { |
581 | - if (!is_dir($directory) || !is_readable($directory)) |
|
582 | - throw new InvalidArgumentException($directory.' is not a valid directory to archive'); |
|
591 | + if (!is_dir($directory) || !is_readable($directory)) { |
|
592 | + throw new InvalidArgumentException($directory.' is not a valid directory to archive'); |
|
593 | + } |
|
583 | 594 | |
584 | 595 | return static::archiveFiles($directory, $archiveName, $compressionLevel, $password) > 0; |
585 | 596 | } |
@@ -615,9 +626,9 @@ discard block |
||
615 | 626 | if (is_array($nodes)) { |
616 | 627 | foreach ($nodes as $destination => $source) { |
617 | 628 | // new format |
618 | - if (is_numeric($destination)) |
|
619 | - $destination = $source; |
|
620 | - else { |
|
629 | + if (is_numeric($destination)) { |
|
630 | + $destination = $source; |
|
631 | + } else { |
|
621 | 632 | // old format |
622 | 633 | if (is_string($source) && !file_exists($source)) { |
623 | 634 | list($destination, $source) = [$source, $destination]; |
@@ -651,11 +662,12 @@ discard block |
||
651 | 662 | |
652 | 663 | } else if (is_string($nodes)) { // passed one file or directory |
653 | 664 | // if is directory |
654 | - if (is_dir($nodes)) |
|
655 | - static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true, |
|
665 | + if (is_dir($nodes)) { |
|
666 | + static::importFilesFromDir(rtrim($nodes, '/\\*').'/*', null, true, |
|
656 | 667 | $files); |
657 | - else if (is_file($nodes)) |
|
658 | - $files[basename($nodes)] = $nodes; |
|
668 | + } else if (is_file($nodes)) { |
|
669 | + $files[basename($nodes)] = $nodes; |
|
670 | + } |
|
659 | 671 | } |
660 | 672 | |
661 | 673 | return $files; |
@@ -672,8 +684,9 @@ discard block |
||
672 | 684 | // $map[$destination] = rtrim($source, '/*'); |
673 | 685 | // do not map root archive folder |
674 | 686 | |
675 | - if ($destination !== null) |
|
676 | - $map[$destination] = null; |
|
687 | + if ($destination !== null) { |
|
688 | + $map[$destination] = null; |
|
689 | + } |
|
677 | 690 | |
678 | 691 | foreach (glob($source, GLOB_MARK) as $node) { |
679 | 692 | if (in_array(substr($node, -1), ['/', '\\'], true) && $recursive) { |
@@ -29,7 +29,7 @@ |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | if (!empty($previous_comment = $archive->getComment())) { |
32 | - $output->writeln('Comment "' . $previous_comment . '" replaced', OutputInterface::OUTPUT_RAW); |
|
32 | + $output->writeln('Comment "'.$previous_comment.'" replaced', OutputInterface::OUTPUT_RAW); |
|
33 | 33 | } else if ($comment === null) { |
34 | 34 | $output->writeln('Comment deleted', OutputInterface::OUTPUT_RAW); |
35 | 35 | } else { |
@@ -31,10 +31,10 @@ |
||
31 | 31 | $archive = $this->getArchive($input, $output); |
32 | 32 | |
33 | 33 | if (disk_free_space($output_dir) < $archive->getOriginalSize()) { |
34 | - throw new \LogicException('Archive size ' . implode($this->formatSize($archive->getOriginalSize())) . ' is more that available on disk ' |
|
34 | + throw new \LogicException('Archive size '.implode($this->formatSize($archive->getOriginalSize())).' is more that available on disk ' |
|
35 | 35 | . implode($this->formatSize(disk_free_space($output_dir)))); |
36 | 36 | } |
37 | 37 | $archive->extractFiles($output_dir, $entry_selector, true); |
38 | - $output->writeln('<info>Extracted all archive contents (' . implode($this->formatSize($archive->getOriginalSize())) . ')</info>'); |
|
38 | + $output->writeln('<info>Extracted all archive contents ('.implode($this->formatSize($archive->getOriginalSize())).')</info>'); |
|
39 | 39 | } |
40 | 40 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if (empty($destination)) { |
49 | 49 | throw new \LogicException('Source and destination can not be empty'); |
50 | 50 | } |
51 | - $output->writeln('<info>Read ' . $data_size . ' from input</info>'); |
|
51 | + $output->writeln('<info>Read '.$data_size.' from input</info>'); |
|
52 | 52 | } else { |
53 | 53 | $data_size = filesize($source); |
54 | 54 | } |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | } |
76 | 76 | if ($added_files === 1) { |
77 | 77 | $details = $archive->getFileData($destination); |
78 | - $output->writeln('Added <comment>' . $source . '</comment>(' |
|
79 | - . implode($this->formatSize($data_size)) . ') as ' |
|
80 | - . $destination . ' (' |
|
78 | + $output->writeln('Added <comment>'.$source.'</comment>(' |
|
79 | + . implode($this->formatSize($data_size)).') as ' |
|
80 | + . $destination.' (' |
|
81 | 81 | . implode($this->formatSize($details->compressedSize)) |
82 | 82 | . ')'); |
83 | 83 | } |
@@ -26,14 +26,14 @@ |
||
26 | 26 | $file = realpath($input->getArgument('archive')); |
27 | 27 | $archive = $this->getArchive($input, $output); |
28 | 28 | |
29 | - $output->writeln('Filename: ' . $file . ' (changed <comment>' . $this->formatDate(filemtime($file)) . '</comment>)'); |
|
30 | - $output->writeln('Type: <info>' . $archive->getFormat() . '</info>, mime <info>' . $archive->getMimeType() . '</info> (via driver <comment>' . $archive->getDriverType() . '</comment>)'); |
|
31 | - $output->writeln('Contains: ' . $archive->countFiles() . ' file' . ($archive->countFiles() > 1 ? 's' : null)); |
|
29 | + $output->writeln('Filename: '.$file.' (changed <comment>'.$this->formatDate(filemtime($file)).'</comment>)'); |
|
30 | + $output->writeln('Type: <info>'.$archive->getFormat().'</info>, mime <info>'.$archive->getMimeType().'</info> (via driver <comment>'.$archive->getDriverType().'</comment>)'); |
|
31 | + $output->writeln('Contains: '.$archive->countFiles().' file'.($archive->countFiles() > 1 ? 's' : null)); |
|
32 | 32 | $output->writeln('Size:'); |
33 | - $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2))); |
|
34 | - $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2))); |
|
35 | - $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)'); |
|
33 | + $output->writeln("\t".'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2))); |
|
34 | + $output->writeln("\t".'compressed: '.implode(' ', $this->formatSize($archive->getCompressedSize(), 2))); |
|
35 | + $output->writeln("\t".'ratio: <info>'.round($archive->getOriginalSize() / $archive->getCompressedSize(), 6).'/1 ('.floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100).'%</info>)'); |
|
36 | 36 | if (!empty($comment = $archive->getComment())) |
37 | - $output->writeln('Comment: <comment>' . $comment . '</comment>'); |
|
37 | + $output->writeln('Comment: <comment>'.$comment.'</comment>'); |
|
38 | 38 | } |
39 | 39 | } |
@@ -33,7 +33,8 @@ |
||
33 | 33 | $output->writeln("\t". 'uncompressed: '.implode(' ', $this->formatSize($archive->getOriginalSize(), 2))); |
34 | 34 | $output->writeln("\t" . 'compressed: ' . implode(' ', $this->formatSize($archive->getCompressedSize(), 2))); |
35 | 35 | $output->writeln("\t" . 'ratio: <info>' . round($archive->getOriginalSize() / $archive->getCompressedSize(), 6) . '/1 (' . floor($archive->getCompressedSize() / $archive->getOriginalSize() * 100) . '%</info>)'); |
36 | - if (!empty($comment = $archive->getComment())) |
|
37 | - $output->writeln('Comment: <comment>' . $comment . '</comment>'); |
|
36 | + if (!empty($comment = $archive->getComment())) { |
|
37 | + $output->writeln('Comment: <comment>' . $comment . '</comment>'); |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | } |