@@ -17,7 +17,7 @@ |
||
17 | 17 | private static $AVERAGE_COMPRESSION_RATIO = 2; |
18 | 18 | public static $forceTmpFile = false; |
19 | 19 | /** High limit. unit: MBytes. |
20 | - */ |
|
20 | + */ |
|
21 | 21 | public static $highLimit = 512; |
22 | 22 | |
23 | 23 | private $mode; |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public static function registerWrapper() |
13 | 13 | { |
14 | - if (!self::$registered) |
|
15 | - stream_wrapper_register('compress.lzw', __CLASS__); |
|
14 | + if (!self::$registered) { |
|
15 | + stream_wrapper_register('compress.lzw', __CLASS__); |
|
16 | + } |
|
16 | 17 | self::$registered = true; |
17 | 18 | } |
18 | 19 | |
@@ -43,12 +44,14 @@ discard block |
||
43 | 44 | { |
44 | 45 | // check for compress & uncompress utility |
45 | 46 | $this->checkBinary(); |
46 | - if (self::$installed === false) |
|
47 | - throw new \Exception('compress and uncompress commands are required'); |
|
47 | + if (self::$installed === false) { |
|
48 | + throw new \Exception('compress and uncompress commands are required'); |
|
49 | + } |
|
48 | 50 | |
49 | 51 | $schema = 'compress.lzw://'; |
50 | - if (strncasecmp($schema, $path, strlen($schema)) == 0) |
|
51 | - $path = substr($path, strlen($schema)); |
|
52 | + if (strncasecmp($schema, $path, strlen($schema)) == 0) { |
|
53 | + $path = substr($path, strlen($schema)); |
|
54 | + } |
|
52 | 55 | |
53 | 56 | if (file_exists($path)) { |
54 | 57 | $this->path = realpath($path); |
@@ -62,14 +65,16 @@ discard block |
||
62 | 65 | $this->read(); |
63 | 66 | } else { |
64 | 67 | $prefix = basename(__FILE__, '.php'); |
65 | - if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) |
|
66 | - throw new \Exception(__CLASS__.', line '.__LINE__. |
|
68 | + if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) { |
|
69 | + throw new \Exception(__CLASS__.', line '.__LINE__. |
|
67 | 70 | ': Could not create temporary file in '. |
68 | 71 | sys_get_temp_dir()); |
69 | - if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) |
|
70 | - throw new \Exception(__CLASS__.', line '.__LINE__. |
|
72 | + } |
|
73 | + if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) { |
|
74 | + throw new \Exception(__CLASS__.', line '.__LINE__. |
|
71 | 75 | ': Could not create temporary file in '. |
72 | 76 | sys_get_temp_dir()); |
77 | + } |
|
73 | 78 | $this->tmp = $tmp; |
74 | 79 | $this->tmp2 = $tmp2; |
75 | 80 | $this->read(); |
@@ -78,14 +83,16 @@ discard block |
||
78 | 83 | $this->path = $path; |
79 | 84 | if (self::$forceTmpFile) { |
80 | 85 | $prefix = basename(__FILE__, '.php'); |
81 | - if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) |
|
82 | - throw new \Exception(__CLASS__.', line '.__LINE__. |
|
86 | + if (($tmp = tempnam(sys_get_temp_dir(), $prefix)) === false) { |
|
87 | + throw new \Exception(__CLASS__.', line '.__LINE__. |
|
83 | 88 | ': Could not create temporary file in '. |
84 | 89 | sys_get_temp_dir()); |
85 | - if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) |
|
86 | - throw new \Exception(__CLASS__.', line '.__LINE__. |
|
90 | + } |
|
91 | + if (($tmp2 = tempnam(sys_get_temp_dir(), $prefix)) === false) { |
|
92 | + throw new \Exception(__CLASS__.', line '.__LINE__. |
|
87 | 93 | ': Could not create temporary file in '. |
88 | 94 | sys_get_temp_dir()); |
95 | + } |
|
89 | 96 | $this->tmp = $tmp; |
90 | 97 | $this->tmp2 = $tmp2; |
91 | 98 | $this->pointer = 0; |
@@ -266,7 +273,9 @@ discard block |
||
266 | 273 | } |
267 | 274 | if ($this->tmp !== null) { |
268 | 275 | unlink($this->tmp); |
269 | - if (file_exists($this->tmp2)) unlink($this->tmp2); |
|
276 | + if (file_exists($this->tmp2)) { |
|
277 | + unlink($this->tmp2); |
|
278 | + } |
|
270 | 279 | } else { |
271 | 280 | $this->data = null; |
272 | 281 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | if (!empty($not_installed)) { |
61 | 61 | echo 'Not supported archive types:'.PHP_EOL; |
62 | - array_walk($not_installed, function ($instruction, $extension) { |
|
62 | + array_walk($not_installed, function($instruction, $extension) { |
|
63 | 63 | echo '- '.$extension.': '.$instruction.PHP_EOL; |
64 | 64 | }); |
65 | 65 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | if ($archived_files === false) |
290 | 290 | echo 'Error'.PHP_EOL; |
291 | 291 | else |
292 | - echo 'Created archive ' . $args['ARCHIVE'] . ' with ' . $archived_files . ' file(s) of total size ' . implode('', $this->formatSize(filesize($args['ARCHIVE']))) . PHP_EOL; |
|
292 | + echo 'Created archive '.$args['ARCHIVE'].' with '.$archived_files.' file(s) of total size '.implode('', $this->formatSize(filesize($args['ARCHIVE']))).PHP_EOL; |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | } |
@@ -12,12 +12,14 @@ discard block |
||
12 | 12 | */ |
13 | 13 | protected function open($file) |
14 | 14 | { |
15 | - if (!UnifiedArchive::canOpenArchive($file)) |
|
16 | - throw new Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.'); |
|
15 | + if (!UnifiedArchive::canOpenArchive($file)) { |
|
16 | + throw new Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.'); |
|
17 | + } |
|
17 | 18 | |
18 | 19 | $archive = UnifiedArchive::open($file); |
19 | - if ($archive === null) |
|
20 | - throw new Exception('Could not open archive '.$file); |
|
20 | + if ($archive === null) { |
|
21 | + throw new Exception('Could not open archive '.$file); |
|
22 | + } |
|
21 | 23 | |
22 | 24 | return $archive; |
23 | 25 | } |
@@ -135,17 +137,18 @@ discard block |
||
135 | 137 | */ |
136 | 138 | public function formatDate($unixtime) |
137 | 139 | { |
138 | - if (strtotime('today') < $unixtime) |
|
139 | - return 'Today, '.date('G:m', $unixtime); |
|
140 | - else if (strtotime('yesterday') < $unixtime) |
|
141 | - return 'Yesterday, '.date('G:m', $unixtime); |
|
142 | - else { |
|
140 | + if (strtotime('today') < $unixtime) { |
|
141 | + return 'Today, '.date('G:m', $unixtime); |
|
142 | + } else if (strtotime('yesterday') < $unixtime) { |
|
143 | + return 'Yesterday, '.date('G:m', $unixtime); |
|
144 | + } else { |
|
143 | 145 | $datetime = new \DateTime(); |
144 | 146 | $datetime->setTimestamp($unixtime); |
145 | - if ($datetime->format('Y') == date('Y')) |
|
146 | - return $datetime->format('d M, G:m'); |
|
147 | - else |
|
148 | - return $datetime->format('d M Y, G:m'); |
|
147 | + if ($datetime->format('Y') == date('Y')) { |
|
148 | + return $datetime->format('d M, G:m'); |
|
149 | + } else { |
|
150 | + return $datetime->format('d M Y, G:m'); |
|
151 | + } |
|
149 | 152 | } |
150 | 153 | } |
151 | 154 | |
@@ -175,25 +178,36 @@ discard block |
||
175 | 178 | $archive = $this->open($args['ARCHIVE']); |
176 | 179 | $output = getcwd(); |
177 | 180 | if (isset($args['--output'])) { |
178 | - if (!is_dir($args['--output'])) |
|
179 | - mkdir($args['--output']); |
|
181 | + if (!is_dir($args['--output'])) { |
|
182 | + mkdir($args['--output']); |
|
183 | + } |
|
180 | 184 | $output = realpath($args['--output']); |
181 | 185 | } |
182 | 186 | |
183 | 187 | if (empty($args['FILES_IN_ARCHIVE']) || $args['FILES_IN_ARCHIVE'] == array('/') || $args['FILES_IN_ARCHIVE'] == array('*')) { |
184 | 188 | $result = $archive->extractFiles($output); |
185 | - if ($result === false) echo 'Error occured'.PHP_EOL; |
|
186 | - else echo 'Extracted '.$result.' file(s) to '.$output.PHP_EOL; |
|
189 | + if ($result === false) { |
|
190 | + echo 'Error occured'.PHP_EOL; |
|
191 | + } else { |
|
192 | + echo 'Extracted '.$result.' file(s) to '.$output.PHP_EOL; |
|
193 | + } |
|
187 | 194 | } else { |
188 | 195 | $extracted = 0; |
189 | 196 | $errored = []; |
190 | 197 | foreach ($args['FILES_IN_ARCHIVE'] as $file) { |
191 | 198 | $result = $archive->extractFiles($output, $file); |
192 | - if ($result === false) $errored[] = $file; |
|
193 | - else $extracted += $result; |
|
199 | + if ($result === false) { |
|
200 | + $errored[] = $file; |
|
201 | + } else { |
|
202 | + $extracted += $result; |
|
203 | + } |
|
204 | + } |
|
205 | + if (!empty($errored)) { |
|
206 | + echo 'Errored: '.implode(', ', $errored).PHP_EOL; |
|
207 | + } |
|
208 | + if ($extracted > 0) { |
|
209 | + echo 'Exctracted '.$extracted.' file(s) to '.$output.PHP_EOL; |
|
194 | 210 | } |
195 | - if (!empty($errored)) echo 'Errored: '.implode(', ', $errored).PHP_EOL; |
|
196 | - if ($extracted > 0) echo 'Exctracted '.$extracted.' file(s) to '.$output.PHP_EOL; |
|
197 | 211 | } |
198 | 212 | } |
199 | 213 | |
@@ -252,8 +266,9 @@ discard block |
||
252 | 266 | echo 'File '.$file.' is NOT in archive'.PHP_EOL; |
253 | 267 | continue; |
254 | 268 | } |
255 | - if ($archive->deleteFiles($file) === false) |
|
256 | - echo 'Error file '.$file.PHP_EOL; |
|
269 | + if ($archive->deleteFiles($file) === false) { |
|
270 | + echo 'Error file '.$file.PHP_EOL; |
|
271 | + } |
|
257 | 272 | } |
258 | 273 | } |
259 | 274 | |
@@ -266,10 +281,11 @@ discard block |
||
266 | 281 | { |
267 | 282 | $archive = $this->open($args['ARCHIVE']); |
268 | 283 | $added_files = $archive->addFiles($args['FILES_ON_DISK']); |
269 | - if ($added_files === false) |
|
270 | - echo 'Error'.PHP_EOL; |
|
271 | - else |
|
272 | - echo 'Added '.$added_files.' file(s)'.PHP_EOL; |
|
284 | + if ($added_files === false) { |
|
285 | + echo 'Error'.PHP_EOL; |
|
286 | + } else { |
|
287 | + echo 'Added '.$added_files.' file(s)'.PHP_EOL; |
|
288 | + } |
|
273 | 289 | } |
274 | 290 | |
275 | 291 | /** |
@@ -279,17 +295,18 @@ discard block |
||
279 | 295 | public function create($args) |
280 | 296 | { |
281 | 297 | if (file_exists($args['ARCHIVE'])) { |
282 | - if (is_dir($args['ARCHIVE'])) |
|
283 | - echo $args['ARCHIVE'].' is a directory!'.PHP_EOL; |
|
284 | - else { |
|
298 | + if (is_dir($args['ARCHIVE'])) { |
|
299 | + echo $args['ARCHIVE'].' is a directory!'.PHP_EOL; |
|
300 | + } else { |
|
285 | 301 | echo 'File '.$args['ARCHIVE'].' already exists!'.PHP_EOL; |
286 | 302 | } |
287 | 303 | } else { |
288 | 304 | $archived_files = UnifiedArchive::archiveFiles($args['FILES_ON_DISK'], $args['ARCHIVE']); |
289 | - if ($archived_files === false) |
|
290 | - echo 'Error'.PHP_EOL; |
|
291 | - else |
|
292 | - echo 'Created archive ' . $args['ARCHIVE'] . ' with ' . $archived_files . ' file(s) of total size ' . implode('', $this->formatSize(filesize($args['ARCHIVE']))) . PHP_EOL; |
|
305 | + if ($archived_files === false) { |
|
306 | + echo 'Error'.PHP_EOL; |
|
307 | + } else { |
|
308 | + echo 'Created archive ' . $args['ARCHIVE'] . ' with ' . $archived_files . ' file(s) of total size ' . implode('', $this->formatSize(filesize($args['ARCHIVE']))) . PHP_EOL; |
|
309 | + } |
|
293 | 310 | } |
294 | 311 | } |
295 | 312 | } |
@@ -63,8 +63,9 @@ |
||
63 | 63 | $this->compressed_size = $this->compressedSize = $compressedSize; |
64 | 64 | $this->uncompressed_size = $this->uncompressedSize = $uncompressedSize; |
65 | 65 | $this->mtime = $this->modificationTime = $modificationTime; |
66 | - if ($isCompressed === null) |
|
67 | - $isCompressed = $uncompressedSize !== $compressedSize; |
|
66 | + if ($isCompressed === null) { |
|
67 | + $isCompressed = $uncompressedSize !== $compressedSize; |
|
68 | + } |
|
68 | 69 | $this->is_compressed = $this->isCompressed = $isCompressed; |
69 | 70 | } |
70 | 71 | } |
71 | 72 | \ No newline at end of file |
@@ -205,7 +205,7 @@ |
||
205 | 205 | * @return false|int |
206 | 206 | * @throws \Exception |
207 | 207 | */ |
208 | - public static function createArchive(array $files, $archiveFileName){ |
|
208 | + public static function createArchive(array $files, $archiveFileName) { |
|
209 | 209 | $zip = new ZipArchive(); |
210 | 210 | $result = $zip->open($archiveFileName, ZipArchive::CREATE); |
211 | 211 | if ($result !== true) |
@@ -60,8 +60,9 @@ discard block |
||
60 | 60 | for ($i = 0; $i < $this->zip->numFiles; $i++) { |
61 | 61 | $file = $this->zip->statIndex($i); |
62 | 62 | // skip directories |
63 | - if (in_array(substr($file['name'], -1), ['/', '\\'], true)) |
|
64 | - continue; |
|
63 | + if (in_array(substr($file['name'], -1), ['/', '\\'], true)) { |
|
64 | + continue; |
|
65 | + } |
|
65 | 66 | $information->files[$i] = $file['name']; |
66 | 67 | $information->compressedFilesSize += $file['comp_size']; |
67 | 68 | $information->uncompressedFilesSize += $file['size']; |
@@ -78,8 +79,9 @@ discard block |
||
78 | 79 | for ($i = 0; $i < $this->zip->numFiles; $i++) { |
79 | 80 | $file_name = $this->zip->getNameIndex($i); |
80 | 81 | // skip directories |
81 | - if (in_array(substr($file_name, -1), ['/', '\\'], true)) |
|
82 | - continue; |
|
82 | + if (in_array(substr($file_name, -1), ['/', '\\'], true)) { |
|
83 | + continue; |
|
84 | + } |
|
83 | 85 | $files[] = $file_name; |
84 | 86 | } |
85 | 87 | return $files; |
@@ -116,8 +118,9 @@ discard block |
||
116 | 118 | public function getFileContent($fileName) |
117 | 119 | { |
118 | 120 | $result = $this->zip->getFromName($fileName); |
119 | - if ($result === false) |
|
120 | - throw new Exception('Could not get file information: '.$result); |
|
121 | + if ($result === false) { |
|
122 | + throw new Exception('Could not get file information: '.$result); |
|
123 | + } |
|
121 | 124 | return $result; |
122 | 125 | } |
123 | 126 | |
@@ -139,8 +142,9 @@ discard block |
||
139 | 142 | */ |
140 | 143 | public function extractFiles($outputFolder, array $files) |
141 | 144 | { |
142 | - if ($this->zip->extractTo($outputFolder, $files) === false) |
|
143 | - throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
145 | + if ($this->zip->extractTo($outputFolder, $files) === false) { |
|
146 | + throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
147 | + } |
|
144 | 148 | |
145 | 149 | return count($files); |
146 | 150 | } |
@@ -151,8 +155,9 @@ discard block |
||
151 | 155 | */ |
152 | 156 | public function extractArchive($outputFolder) |
153 | 157 | { |
154 | - if ($this->zip->extractTo($outputFolder) === false) |
|
155 | - throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
158 | + if ($this->zip->extractTo($outputFolder) === false) { |
|
159 | + throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
160 | + } |
|
156 | 161 | return $this->zip->numFiles; |
157 | 162 | } |
158 | 163 | |
@@ -166,8 +171,9 @@ discard block |
||
166 | 171 | { |
167 | 172 | $count = 0; |
168 | 173 | foreach ($files as $file) { |
169 | - if ($this->zip->deleteName($file) === false) |
|
170 | - throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
174 | + if ($this->zip->deleteName($file) === false) { |
|
175 | + throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
176 | + } |
|
171 | 177 | $count++; |
172 | 178 | } |
173 | 179 | |
@@ -190,11 +196,13 @@ discard block |
||
190 | 196 | $added_files = 0; |
191 | 197 | foreach ($files as $localName => $fileName) { |
192 | 198 | if (is_null($fileName)) { |
193 | - if ($this->zip->addEmptyDir($localName) === false) |
|
194 | - throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
199 | + if ($this->zip->addEmptyDir($localName) === false) { |
|
200 | + throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
201 | + } |
|
195 | 202 | } else { |
196 | - if ($this->zip->addFile($fileName, $localName) === false) |
|
197 | - throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
203 | + if ($this->zip->addFile($fileName, $localName) === false) { |
|
204 | + throw new Exception($this->zip->getStatusString(), $this->zip->status); |
|
205 | + } |
|
198 | 206 | $added_files++; |
199 | 207 | } |
200 | 208 | } |
@@ -217,15 +225,18 @@ discard block |
||
217 | 225 | public static function createArchive(array $files, $archiveFileName){ |
218 | 226 | $zip = new ZipArchive(); |
219 | 227 | $result = $zip->open($archiveFileName, ZipArchive::CREATE); |
220 | - if ($result !== true) |
|
221 | - throw new Exception('ZipArchive error: '.$result); |
|
228 | + if ($result !== true) { |
|
229 | + throw new Exception('ZipArchive error: '.$result); |
|
230 | + } |
|
222 | 231 | foreach ($files as $localName => $fileName) { |
223 | 232 | if ($fileName === null) { |
224 | - if ($zip->addEmptyDir($localName) === false) |
|
225 | - return false; |
|
233 | + if ($zip->addEmptyDir($localName) === false) { |
|
234 | + return false; |
|
235 | + } |
|
226 | 236 | } else { |
227 | - if ($zip->addFile($fileName, $localName) === false) |
|
228 | - return false; |
|
237 | + if ($zip->addFile($fileName, $localName) === false) { |
|
238 | + return false; |
|
239 | + } |
|
229 | 240 | } |
230 | 241 | } |
231 | 242 | $zip->close(); |
@@ -129,7 +129,7 @@ |
||
129 | 129 | * @return false|int |
130 | 130 | * @throws \wapmorgan\UnifiedArchive\UnsupportedOperationException |
131 | 131 | */ |
132 | - public static function createArchive(array $files, $archiveFileName){ |
|
132 | + public static function createArchive(array $files, $archiveFileName) { |
|
133 | 133 | if (count($files) > 1) return false; |
134 | 134 | $filename = array_shift($files); |
135 | 135 | if (is_null($filename)) return false; // invalid list |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct($archiveFileName) |
27 | 27 | { |
28 | - if (static::FORMAT_SUFFIX === null) |
|
29 | - throw new \Exception('Format should be initialized'); |
|
28 | + if (static::FORMAT_SUFFIX === null) { |
|
29 | + throw new \Exception('Format should be initialized'); |
|
30 | + } |
|
30 | 31 | $this->fileName = $archiveFileName; |
31 | 32 | $this->inArchiveFileName = basename($archiveFileName, '.'.self::FORMAT_SUFFIX); |
32 | 33 | } |
@@ -93,11 +94,13 @@ discard block |
||
93 | 94 | public function extractArchive($outputFolder) |
94 | 95 | { |
95 | 96 | $data = $this->getFileContent($this->inArchiveFileName); |
96 | - if ($data === false) |
|
97 | - throw new Exception('Could not extract archive'); |
|
97 | + if ($data === false) { |
|
98 | + throw new Exception('Could not extract archive'); |
|
99 | + } |
|
98 | 100 | |
99 | - if (file_put_contents($outputFolder.$this->inArchiveFileName, $data) !== false) |
|
100 | - return 1; |
|
101 | + if (file_put_contents($outputFolder.$this->inArchiveFileName, $data) !== false) { |
|
102 | + return 1; |
|
103 | + } |
|
101 | 104 | } |
102 | 105 | |
103 | 106 | /** |
@@ -130,12 +133,18 @@ discard block |
||
130 | 133 | * @throws \wapmorgan\UnifiedArchive\UnsupportedOperationException |
131 | 134 | */ |
132 | 135 | public static function createArchive(array $files, $archiveFileName){ |
133 | - if (count($files) > 1) return false; |
|
136 | + if (count($files) > 1) { |
|
137 | + return false; |
|
138 | + } |
|
134 | 139 | $filename = array_shift($files); |
135 | - if (is_null($filename)) return false; // invalid list |
|
140 | + if (is_null($filename)) { |
|
141 | + return false; |
|
142 | + } |
|
143 | + // invalid list |
|
136 | 144 | if (file_put_contents($archiveFileName, |
137 | - static::compressData(file_get_contents($filename))) !== false) |
|
138 | - return 1; |
|
145 | + static::compressData(file_get_contents($filename))) !== false) { |
|
146 | + return 1; |
|
147 | + } |
|
139 | 148 | } |
140 | 149 | |
141 | 150 | /** |
@@ -35,8 +35,8 @@ |
||
35 | 35 | $information = new ArchiveInformation(); |
36 | 36 | foreach ($this->sevenZip->getEntries() as $entry) { |
37 | 37 | $information->files[] = $entry->getPath(); |
38 | - $information->compressedFilesSize += (int)$entry->getPackedSize(); |
|
39 | - $information->uncompressedFilesSize += (int)$entry->getSize(); |
|
38 | + $information->compressedFilesSize += (int) $entry->getPackedSize(); |
|
39 | + $information->uncompressedFilesSize += (int) $entry->getSize(); |
|
40 | 40 | } |
41 | 41 | return $information; |
42 | 42 | } |
@@ -47,8 +47,9 @@ |
||
47 | 47 | public function getFileNames() |
48 | 48 | { |
49 | 49 | $files = []; |
50 | - foreach ($this->sevenZip->getEntries() as $entry) |
|
51 | - $files[] = $entry->getPath(); |
|
50 | + foreach ($this->sevenZip->getEntries() as $entry) { |
|
51 | + $files[] = $entry->getPath(); |
|
52 | + } |
|
52 | 53 | return $files; |
53 | 54 | } |
54 | 55 |
@@ -167,7 +167,7 @@ |
||
167 | 167 | * @param string $archiveFileName |
168 | 168 | * @throws \wapmorgan\UnifiedArchive\UnsupportedOperationException |
169 | 169 | */ |
170 | - public static function createArchive(array $files, $archiveFileName){ |
|
170 | + public static function createArchive(array $files, $archiveFileName) { |
|
171 | 171 | throw new UnsupportedOperationException(); |
172 | 172 | } |
173 | 173 | } |
174 | 174 | \ No newline at end of file |
@@ -101,7 +101,9 @@ discard block |
||
101 | 101 | public function getFileContent($fileName) |
102 | 102 | { |
103 | 103 | $entry = $this->rar->getEntry($fileName); |
104 | - if ($entry->isDirectory()) return false; |
|
104 | + if ($entry->isDirectory()) { |
|
105 | + return false; |
|
106 | + } |
|
105 | 107 | return stream_get_contents($entry->getStream()); |
106 | 108 | } |
107 | 109 | |
@@ -113,7 +115,9 @@ discard block |
||
113 | 115 | public function getFileResource($fileName) |
114 | 116 | { |
115 | 117 | $entry = $this->rar->getEntry($fileName); |
116 | - if ($entry->isDirectory()) return false; |
|
118 | + if ($entry->isDirectory()) { |
|
119 | + return false; |
|
120 | + } |
|
117 | 121 | return $entry->getStream(); |
118 | 122 | } |
119 | 123 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | */ |
10 | 10 | class Lzma extends OneFileFormat |
11 | 11 | { |
12 | - const FORMAT_SUFFIX = 'xz'; |
|
12 | + const FORMAT_SUFFIX = 'xz'; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * Lzma constructor. |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | class Bzip extends OneFileFormat |
7 | 7 | { |
8 | - const FORMAT_SUFFIX = 'bz2'; |
|
8 | + const FORMAT_SUFFIX = 'bz2'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Bzip constructor. |