@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | public static function open($fileName, $abilities = [], $password = null) |
67 | 67 | { |
68 | 68 | if (!file_exists($fileName) || !is_readable($fileName)) { |
69 | - throw new InvalidArgumentException('Could not open file: ' . $fileName.' is not readable'); |
|
69 | + throw new InvalidArgumentException('Could not open file: '.$fileName.' is not readable'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $format = Formats::detectArchiveFormat($fileName); |
73 | 73 | if ($format === false) { |
74 | - throw new UnsupportedArchiveException('Can not recognize archive format for ' . $fileName); |
|
74 | + throw new UnsupportedArchiveException('Can not recognize archive format for '.$fileName); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | if (!empty($abilities) && is_string($abilities)) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | $driver = Formats::getFormatDriver($format, $abilities); |
89 | 89 | if ($driver === null) { |
90 | - throw new UnsupportedOperationException('Driver for ' . $format . ' (' . $fileName . ') is not found'); |
|
90 | + throw new UnsupportedOperationException('Driver for '.$format.' ('.$fileName.') is not found'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return new static($fileName, $format, $driver, $password); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | public function getFileData($fileName) |
290 | 290 | { |
291 | 291 | if (!in_array($fileName, $this->files, true)) { |
292 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
292 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | return $this->archive->getFileData($fileName); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | public function getFileContent($fileName) |
306 | 306 | { |
307 | 307 | if (!in_array($fileName, $this->files, true)) { |
308 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
308 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | return $this->archive->getFileContent($fileName); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | public function getFileStream($fileName) |
322 | 322 | { |
323 | 323 | if (!in_array($fileName, $this->files, true)) { |
324 | - throw new NonExistentArchiveFileException('File ' . $fileName . ' does not exist in archive'); |
|
324 | + throw new NonExistentArchiveFileException('File '.$fileName.' does not exist in archive'); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | return $this->archive->getFileStream($fileName); |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | /** @var BasicDriver $driver */ |
585 | 585 | $driver = Formats::getFormatDriver($info['type'], $abilities); |
586 | 586 | if ($driver === null) { |
587 | - throw new UnsupportedArchiveException('Unsupported archive type: ' . $info['type'] . ' of archive '); |
|
587 | + throw new UnsupportedArchiveException('Unsupported archive type: '.$info['type'].' of archive '); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | return $driver::createArchive( |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | public static function archiveFile($file, $archiveName, $compressionLevel = BasicDriver::COMPRESSION_AVERAGE, $password = null) |
612 | 612 | { |
613 | 613 | if (!is_file($file)) { |
614 | - throw new InvalidArgumentException($file . ' is not a valid file to archive'); |
|
614 | + throw new InvalidArgumentException($file.' is not a valid file to archive'); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | return static::archiveFiles($file, $archiveName, $compressionLevel, $password) === 1; |
@@ -682,8 +682,8 @@ discard block |
||
682 | 682 | if (is_array($source)) { |
683 | 683 | foreach ($source as $sourceItem) { |
684 | 684 | static::importFilesFromDir( |
685 | - rtrim($sourceItem, '/\\*') . '/*', |
|
686 | - !empty($destination) ? $destination . '/' : null, |
|
685 | + rtrim($sourceItem, '/\\*').'/*', |
|
686 | + !empty($destination) ? $destination.'/' : null, |
|
687 | 687 | true, |
688 | 688 | $files |
689 | 689 | ); |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | } else if (is_dir($source)) { |
692 | 692 | // one source for directories |
693 | 693 | static::importFilesFromDir( |
694 | - rtrim($source, '/\\*') . '/*', |
|
695 | - !empty($destination) ? $destination . '/' : null, |
|
694 | + rtrim($source, '/\\*').'/*', |
|
695 | + !empty($destination) ? $destination.'/' : null, |
|
696 | 696 | true, |
697 | 697 | $files |
698 | 698 | ); |
@@ -43,12 +43,14 @@ discard block |
||
43 | 43 | */ |
44 | 44 | protected function open($file, $password = null) |
45 | 45 | { |
46 | - if (!UnifiedArchive::canOpen($file)) |
|
47 | - throw new \Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.'); |
|
46 | + if (!UnifiedArchive::canOpen($file)) { |
|
47 | + throw new \Exception('Could not open archive '.$file.'. Try installing suggested packages or run `cam -f` to see formats support.'); |
|
48 | + } |
|
48 | 49 | |
49 | 50 | $archive = UnifiedArchive::open($file, [], $password); |
50 | - if ($archive === null) |
|
51 | - throw new \Exception('Could not open archive '.$file); |
|
51 | + if ($archive === null) { |
|
52 | + throw new \Exception('Could not open archive '.$file); |
|
53 | + } |
|
52 | 54 | |
53 | 55 | return $archive; |
54 | 56 | } |
@@ -61,17 +63,18 @@ discard block |
||
61 | 63 | */ |
62 | 64 | public function formatDate($unixtime) |
63 | 65 | { |
64 | - if (strtotime('today') < $unixtime) |
|
65 | - return 'Today, '.date('G:m', $unixtime); |
|
66 | - else if (strtotime('yesterday') < $unixtime) |
|
67 | - return 'Yesterday, '.date('G:m', $unixtime); |
|
68 | - else { |
|
66 | + if (strtotime('today') < $unixtime) { |
|
67 | + return 'Today, '.date('G:m', $unixtime); |
|
68 | + } else if (strtotime('yesterday') < $unixtime) { |
|
69 | + return 'Yesterday, '.date('G:m', $unixtime); |
|
70 | + } else { |
|
69 | 71 | $datetime = new \DateTime(); |
70 | 72 | $datetime->setTimestamp($unixtime); |
71 | - if ($datetime->format('Y') == date('Y')) |
|
72 | - return $datetime->format('d M, H:m'); |
|
73 | - else |
|
74 | - return $datetime->format('d M Y, H:m'); |
|
73 | + if ($datetime->format('Y') == date('Y')) { |
|
74 | + return $datetime->format('d M, H:m'); |
|
75 | + } else { |
|
76 | + return $datetime->format('d M Y, H:m'); |
|
77 | + } |
|
75 | 78 | } |
76 | 79 | } |
77 | 80 |