@@ -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 | |