@@ -88,7 +88,8 @@ |
||
| 88 | 88 | */ |
| 89 | 89 | public function range($value, int $min, int $max): bool |
| 90 | 90 | { |
| 91 | - if (!is_string($value)) { |
|
| 91 | + if (!is_string($value)) |
|
| 92 | + { |
|
| 92 | 93 | return false; |
| 93 | 94 | } |
| 94 | 95 | |
@@ -113,7 +113,8 @@ |
||
| 113 | 113 | */ |
| 114 | 114 | private function resolveExpirationInterval($expiration): \DateInterval |
| 115 | 115 | { |
| 116 | - if ($expiration === null) { |
|
| 116 | + if ($expiration === null) |
|
| 117 | + { |
|
| 117 | 118 | return $this->expiration; |
| 118 | 119 | } |
| 119 | 120 | |
@@ -78,7 +78,8 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | protected function assertCloudFrontAvailable(): void |
| 80 | 80 | { |
| 81 | - if (\class_exists(UrlSigner::class)) { |
|
| 81 | + if (\class_exists(UrlSigner::class)) |
|
| 82 | + { |
|
| 82 | 83 | return; |
| 83 | 84 | } |
| 84 | 85 | |
@@ -48,7 +48,8 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | private function assertAvailable(): void |
| 50 | 50 | { |
| 51 | - if (\class_exists(Uri::class)) { |
|
| 51 | + if (\class_exists(Uri::class)) |
|
| 52 | + { |
|
| 52 | 53 | return; |
| 53 | 54 | } |
| 54 | 55 | |
@@ -39,11 +39,16 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function create($duration): \DateInterval |
| 41 | 41 | { |
| 42 | - try { |
|
| 42 | + try |
|
| 43 | + { |
|
| 43 | 44 | return $this->createOrFail($duration); |
| 44 | - } catch (\InvalidArgumentException $e) { |
|
| 45 | + } |
|
| 46 | + catch (\InvalidArgumentException $e) |
|
| 47 | + { |
|
| 45 | 48 | throw $e; |
| 46 | - } catch (\Throwable $e) { |
|
| 49 | + } |
|
| 50 | + catch (\Throwable $e) |
|
| 51 | + { |
|
| 47 | 52 | throw new \InvalidArgumentException($e->getMessage(), (int)$e->getCode(), $e); |
| 48 | 53 | } |
| 49 | 54 | } |
@@ -65,7 +70,8 @@ discard block |
||
| 65 | 70 | */ |
| 66 | 71 | private function createOrFail($duration): \DateInterval |
| 67 | 72 | { |
| 68 | - switch (true) { |
|
| 73 | + switch (true) |
|
| 74 | + { |
|
| 69 | 75 | case $duration instanceof \DateInterval: |
| 70 | 76 | return $duration; |
| 71 | 77 | |
@@ -31,7 +31,8 @@ |
||
| 31 | 31 | { |
| 32 | 32 | $resolver = $this->getResolver(); |
| 33 | 33 | |
| 34 | - if ($resolver === null) { |
|
| 34 | + if ($resolver === null) |
|
| 35 | + { |
|
| 35 | 36 | throw new \LogicException('Can not generate public url: File not accessible by HTTP'); |
| 36 | 37 | } |
| 37 | 38 | |
@@ -63,20 +63,26 @@ |
||
| 63 | 63 | ); |
| 64 | 64 | |
| 65 | 65 | /** @var \SplFileInfo $file */ |
| 66 | - foreach($iterator as $file) { |
|
| 67 | - if ($file->getFilename() === '.gitignore') { |
|
| 66 | + foreach($iterator as $file) |
|
| 67 | + { |
|
| 68 | + if ($file->getFilename() === '.gitignore') |
|
| 69 | + { |
|
| 68 | 70 | continue; |
| 69 | 71 | } |
| 70 | 72 | |
| 71 | 73 | \error_clear_last(); |
| 72 | 74 | |
| 73 | - if ($file->isDir()) { |
|
| 75 | + if ($file->isDir()) |
|
| 76 | + { |
|
| 74 | 77 | @\rmdir($file->getPathname()); |
| 75 | - } else { |
|
| 78 | + } |
|
| 79 | + else |
|
| 80 | + { |
|
| 76 | 81 | @\unlink($file->getPathname()); |
| 77 | 82 | } |
| 78 | 83 | |
| 79 | - if ($error = \error_get_last()) { |
|
| 84 | + if ($error = \error_get_last()) |
|
| 85 | + { |
|
| 80 | 86 | $prefix = 'An error occurred while clear temporary local storage directory: '; |
| 81 | 87 | $this->addWarning($prefix . $error['message']); |
| 82 | 88 | } |
@@ -151,7 +151,8 @@ |
||
| 151 | 151 | |
| 152 | 152 | $actual = ''; |
| 153 | 153 | $stream = $this->local->getStream('file.txt'); |
| 154 | - while (!\feof($stream)) { |
|
| 154 | + while (!\feof($stream)) |
|
| 155 | + { |
|
| 155 | 156 | $actual .= \fread($stream, 256); |
| 156 | 157 | } |
| 157 | 158 | \fclose($stream); |
@@ -257,7 +257,8 @@ |
||
| 257 | 257 | |
| 258 | 258 | $actual = ''; |
| 259 | 259 | $stream = $this->manager->getStream('file.txt'); |
| 260 | - while (!\feof($stream)) { |
|
| 260 | + while (!\feof($stream)) |
|
| 261 | + { |
|
| 261 | 262 | $actual .= \fread($stream, 256); |
| 262 | 263 | } |
| 263 | 264 | \fclose($stream); |