@@ -31,11 +31,11 @@ |
||
| 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->extract($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 | return 0; |
| 41 | 41 | } |
@@ -60,17 +60,17 @@ |
||
| 60 | 60 | foreach ($archive->getFiles($filter) as $file) { |
| 61 | 61 | $details = $archive->getFileData($file); |
| 62 | 62 | $output->writeln(($details->isCompressed && $details->uncompressedSize > 0 ? 'x' : '-') |
| 63 | - . ' ' . str_pad( |
|
| 63 | + . ' '.str_pad( |
|
| 64 | 64 | $human_readable_size ? implode($this->formatSize($details->uncompressedSize)) : $details->uncompressedSize, |
| 65 | 65 | $uncomp_size_length, |
| 66 | 66 | ' ', |
| 67 | 67 | STR_PAD_LEFT) |
| 68 | - . ' ' . str_pad( |
|
| 68 | + . ' '.str_pad( |
|
| 69 | 69 | $human_readable_size ? implode($this->formatSize($details->compressedSize)) : $details->compressedSize, |
| 70 | 70 | $comp_size_length, |
| 71 | 71 | ' ', |
| 72 | 72 | STR_PAD_LEFT) |
| 73 | - . ' ' . $this->formatDateShort($details->modificationTime) . ' ' . $details->path); |
|
| 73 | + . ' '.$this->formatDateShort($details->modificationTime).' '.$details->path); |
|
| 74 | 74 | } |
| 75 | 75 | } else { |
| 76 | 76 | foreach ($archive->getFiles($filter) as $file) { |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | list($archive, $file) = $this->getArchiveAndFile($input, $output); |
| 34 | 34 | |
| 35 | 35 | $archive->delete($file); |
| 36 | - $output->writeln('<comment>- file "' . $file . '"</comment>'); |
|
| 36 | + $output->writeln('<comment>- file "'.$file.'"</comment>'); |
|
| 37 | 37 | |
| 38 | 38 | return 0; |
| 39 | 39 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $entry_selector = $input->getArgument('entrySelector'); |
| 34 | 34 | |
| 35 | 35 | $archive->extract($output_dir, $entry_selector, true); |
| 36 | - $output->writeln('<info>Extracted:</info> ' . implode(', ', $entry_selector) . ' (' . count($entry_selector) . ') file(s)'); |
|
| 36 | + $output->writeln('<info>Extracted:</info> '.implode(', ', $entry_selector).' ('.count($entry_selector).') file(s)'); |
|
| 37 | 37 | |
| 38 | 38 | return 0; |
| 39 | 39 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public static function getInstallationInstruction() |
| 31 | 31 | { |
| 32 | - return 'install [' . static::EXTENSION_NAME . '] extension' . "\n" . 'For 5.x: https://github.com/payden/php-xz' . "\n" . 'For 7.x/8.x: https://github.com/codemasher/php-ext-xz'; |
|
| 32 | + return 'install ['.static::EXTENSION_NAME.'] extension'."\n".'For 5.x: https://github.com/payden/php-xz'."\n".'For 7.x/8.x: https://github.com/codemasher/php-ext-xz'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -122,8 +122,9 @@ |
||
| 122 | 122 | public function extractArchive($outputFolder) |
| 123 | 123 | { |
| 124 | 124 | $data = $this->getFileContent($this->inArchiveFileName); |
| 125 | - if ($data === false) |
|
| 126 | - throw new ArchiveExtractionException('Could not extract archive'); |
|
| 125 | + if ($data === false) { |
|
| 126 | + throw new ArchiveExtractionException('Could not extract archive'); |
|
| 127 | + } |
|
| 127 | 128 | |
| 128 | 129 | $size = strlen($data); |
| 129 | 130 | $written = file_put_contents($outputFolder.$this->inArchiveFileName, $data); |
@@ -50,14 +50,14 @@ |
||
| 50 | 50 | { |
| 51 | 51 | $suffix = Formats::getFormatExtension(static::FORMAT); |
| 52 | 52 | if ($suffix === null) { |
| 53 | - throw new \Exception('Format suffix is empty for ' . static::FORMAT . ', it should be initialized!'); |
|
| 53 | + throw new \Exception('Format suffix is empty for '.static::FORMAT.', it should be initialized!'); |
|
| 54 | 54 | } |
| 55 | 55 | if ($password !== null) { |
| 56 | - throw new UnsupportedOperationException($suffix . ' archive does not support password!'); |
|
| 56 | + throw new UnsupportedOperationException($suffix.' archive does not support password!'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | parent::__construct($archiveFileName, $format); |
| 60 | - $this->inArchiveFileName = basename($archiveFileName, '.' . $suffix); |
|
| 60 | + $this->inArchiveFileName = basename($archiveFileName, '.'.$suffix); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | |
| 16 | 16 | public static function getInstallationInstruction() |
| 17 | 17 | { |
| 18 | - return 'install [' . static::EXTENSION_NAME . '] php extension'; |
|
| 18 | + return 'install ['.static::EXTENSION_NAME.'] php extension'; |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | do { |
| 132 | 132 | $temp_file = tempnam(sys_get_temp_dir(), 'temp_archive'); |
| 133 | 133 | unlink($temp_file); |
| 134 | - $archive_file = $temp_file . '.' . $format_extension; |
|
| 134 | + $archive_file = $temp_file.'.'.$format_extension; |
|
| 135 | 135 | } while (file_exists($archive_file)); |
| 136 | 136 | $created = static::createArchive($files, $archive_file, $archiveFormat, $compressionLevel, $password, $fileProgressCallable); |
| 137 | 137 | $string = file_get_contents($archive_file); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $password = $input->getOption('password'); |
| 54 | 54 | $compression = $input->getOption('compression'); |
| 55 | 55 | if (!isset(static::$compressionLevels[$compression])) { |
| 56 | - throw new \InvalidArgumentException('Compression "' . $compression . '" is not valid'); |
|
| 56 | + throw new \InvalidArgumentException('Compression "'.$compression.'" is not valid'); |
|
| 57 | 57 | } |
| 58 | 58 | $compression = static::$compressionLevels[$compression]; |
| 59 | 59 | $path = $input->getOption('path'); |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | if (file_exists($archive_file)) { |
| 68 | 68 | if (is_dir($archive_file)) |
| 69 | - throw new \InvalidArgumentException($archive_file . ' is a directory!'); |
|
| 69 | + throw new \InvalidArgumentException($archive_file.' is a directory!'); |
|
| 70 | 70 | else { |
| 71 | - throw new \InvalidArgumentException('File "' . $archive_file . '" already exists!'); |
|
| 71 | + throw new \InvalidArgumentException('File "'.$archive_file.'" already exists!'); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $files_list[$destination] = $file_to_pack; |
| 83 | 83 | if (!$stdout) { |
| 84 | 84 | $output->writeln( |
| 85 | - '<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', |
|
| 85 | + '<comment>'.$file_to_pack.' => '.$destination.'</comment>', |
|
| 86 | 86 | OutputInterface::VERBOSITY_VERBOSE |
| 87 | 87 | ); |
| 88 | 88 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | if (is_dir($file_to_pack)) { |
| 92 | 92 | if (!$stdout) { |
| 93 | 93 | $output->writeln( |
| 94 | - '<comment>' . $file_to_pack . ' => root</comment>', |
|
| 94 | + '<comment>'.$file_to_pack.' => root</comment>', |
|
| 95 | 95 | OutputInterface::VERBOSITY_VERBOSE |
| 96 | 96 | ); |
| 97 | 97 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } else { |
| 106 | 106 | if (!$stdout) { |
| 107 | 107 | $output->writeln( |
| 108 | - '<comment>' . $file_to_pack . ' => ' . basename($file_to_pack) . '</comment>', |
|
| 108 | + '<comment>'.$file_to_pack.' => '.basename($file_to_pack).'</comment>', |
|
| 109 | 109 | OutputInterface::VERBOSITY_VERBOSE |
| 110 | 110 | ); |
| 111 | 111 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $files_list[$destination] = $file_to_pack; |
| 118 | 118 | if (!$stdout) { |
| 119 | 119 | $output->writeln( |
| 120 | - '<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', |
|
| 120 | + '<comment>'.$file_to_pack.' => '.$destination.'</comment>', |
|
| 121 | 121 | OutputInterface::VERBOSITY_VERBOSE |
| 122 | 122 | ); |
| 123 | 123 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $files_list[$destination] = $file_to_pack; |
| 128 | 128 | if (!$stdout) { |
| 129 | 129 | $output->writeln( |
| 130 | - '<comment>' . $file_to_pack . ' => ' . $destination . '</comment>', |
|
| 130 | + '<comment>'.$file_to_pack.' => '.$destination.'</comment>', |
|
| 131 | 131 | OutputInterface::VERBOSITY_VERBOSE |
| 132 | 132 | ); |
| 133 | 133 | } |
@@ -137,16 +137,16 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | $information = UnifiedArchive::prepareForArchiving($files_list, $archive_file); |
| 139 | 139 | if ($dry_run) { |
| 140 | - $output->writeln('Format: <info>' . $information['type'] . '</info>'); |
|
| 141 | - $output->writeln('Original size: <info>' . implode($this->formatSize($information['totalSize'])) . '</info>'); |
|
| 142 | - $output->writeln('Files: <info>' . $information['numberOfFiles'] . '</info>'); |
|
| 140 | + $output->writeln('Format: <info>'.$information['type'].'</info>'); |
|
| 141 | + $output->writeln('Original size: <info>'.implode($this->formatSize($information['totalSize'])).'</info>'); |
|
| 142 | + $output->writeln('Files: <info>'.$information['numberOfFiles'].'</info>'); |
|
| 143 | 143 | foreach ($information['files'] as $destination => $source) { |
| 144 | 144 | // is folder |
| 145 | 145 | if ($source === null) { |
| 146 | 146 | continue; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $output->writeln($source . ' => <comment>' . $destination . '</comment>'); |
|
| 149 | + $output->writeln($source.' => <comment>'.$destination.'</comment>'); |
|
| 150 | 150 | } |
| 151 | 151 | return 0; |
| 152 | 152 | } |
@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | $progressBar = new ProgressBar($output, $information['numberOfFiles']); |
| 160 | 160 | $progressBar->setFormat('archiving'); |
| 161 | 161 | $progressBar->start(); |
| 162 | - $archived_files = UnifiedArchive::create($files_list, $archive_file, $compression, $password, function ($currentFile, $totalFiles, $fsFilename, $archiveFilename) |
|
| 162 | + $archived_files = UnifiedArchive::create($files_list, $archive_file, $compression, $password, function($currentFile, $totalFiles, $fsFilename, $archiveFilename) |
|
| 163 | 163 | use ($progressBar) { |
| 164 | 164 | if ($fsFilename === null) { |
| 165 | - $progressBar->setMessage('Creating ' . $archiveFilename); |
|
| 165 | + $progressBar->setMessage('Creating '.$archiveFilename); |
|
| 166 | 166 | } else { |
| 167 | 167 | $progressBar->setMessage($fsFilename); |
| 168 | 168 | } |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $output->writeln( |
| 185 | - 'Created <info>' . $archive_file . '</info> with <comment>' . $archived_files . '</comment> file(s) (' |
|
| 186 | - . implode($this->formatSize($archive->getOriginalSize())) . ') of total size ' |
|
| 185 | + 'Created <info>'.$archive_file.'</info> with <comment>'.$archived_files.'</comment> file(s) (' |
|
| 186 | + . implode($this->formatSize($archive->getOriginalSize())).') of total size ' |
|
| 187 | 187 | . implode($this->formatSize(filesize($archive_file))) |
| 188 | 188 | ); |
| 189 | 189 | |
@@ -65,9 +65,9 @@ |
||
| 65 | 65 | $stdout = $input->getOption('stdout'); |
| 66 | 66 | |
| 67 | 67 | if (file_exists($archive_file)) { |
| 68 | - if (is_dir($archive_file)) |
|
| 69 | - throw new \InvalidArgumentException($archive_file . ' is a directory!'); |
|
| 70 | - else { |
|
| 68 | + if (is_dir($archive_file)) { |
|
| 69 | + throw new \InvalidArgumentException($archive_file . ' is a directory!'); |
|
| 70 | + } else { |
|
| 71 | 71 | throw new \InvalidArgumentException('File "' . $archive_file . '" already exists!'); |
| 72 | 72 | } |
| 73 | 73 | } |