@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function __construct(string $baseUrl, string $signatureSalt) |
| 61 | 61 | { |
| 62 | - if(empty($baseUrl)) { |
|
| 62 | + if (empty($baseUrl)) { |
|
| 63 | 63 | throw new \InvalidArgumentException("Base URL should not be empty"); |
| 64 | 64 | } |
| 65 | 65 | $this->baseUrl = $baseUrl; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function filename(string $filename): UrlBuilder |
| 74 | 74 | { |
| 75 | - if(empty($filename)) { |
|
| 75 | + if (empty($filename)) { |
|
| 76 | 76 | throw new \InvalidArgumentException("Filename should not be empty"); |
| 77 | 77 | } |
| 78 | 78 | $this->filename = $filename; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function extension(string $extension): UrlBuilder |
| 88 | 88 | { |
| 89 | - if(empty($extension)) { |
|
| 89 | + if (empty($extension)) { |
|
| 90 | 90 | throw new \InvalidArgumentException("Extension should not be empty"); |
| 91 | 91 | } |
| 92 | 92 | $this->extension = $extension; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function cast(int $cast): UrlBuilder |
| 102 | 102 | { |
| 103 | - if(empty($cast)) { |
|
| 103 | + if (empty($cast)) { |
|
| 104 | 104 | $this->cast = 0; |
| 105 | 105 | } |
| 106 | 106 | elseif ($cast < 0) { |
@@ -102,11 +102,9 @@ |
||
| 102 | 102 | { |
| 103 | 103 | if(empty($cast)) { |
| 104 | 104 | $this->cast = 0; |
| 105 | - } |
|
| 106 | - elseif ($cast < 0) { |
|
| 105 | + } elseif ($cast < 0) { |
|
| 107 | 106 | throw new \InvalidArgumentException("Cast flag should not be less than nil"); |
| 108 | - } |
|
| 109 | - else { |
|
| 107 | + } else { |
|
| 110 | 108 | $this->cast |= $cast; |
| 111 | 109 | } |
| 112 | 110 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function __construct(string $baseUrl, string $signatureSalt) |
| 32 | 32 | { |
| 33 | - if(empty($baseUrl)) { |
|
| 33 | + if (empty($baseUrl)) { |
|
| 34 | 34 | throw new \InvalidArgumentException("Base URL should not be empty"); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected function http(): Client |
| 45 | 45 | { |
| 46 | - if(empty($this->http)) { |
|
| 46 | + if (empty($this->http)) { |
|
| 47 | 47 | $this->http = new Client([ |
| 48 | 48 | 'base_uri' => $this->baseUrl |
| 49 | 49 | ]); |
@@ -64,19 +64,19 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $builder = UrlBuilder::construct($this->baseUrl, $this->signatureSalt); |
| 66 | 66 | |
| 67 | - if(!empty($width)) { |
|
| 67 | + if (!empty($width)) { |
|
| 68 | 68 | $builder->width($width); |
| 69 | 69 | } |
| 70 | - if(!empty($height)) { |
|
| 70 | + if (!empty($height)) { |
|
| 71 | 71 | $builder->height($height); |
| 72 | 72 | } |
| 73 | - if(!empty($cast)) { |
|
| 73 | + if (!empty($cast)) { |
|
| 74 | 74 | $builder->cast($cast); |
| 75 | 75 | } |
| 76 | - if(!empty($filename)) { |
|
| 76 | + if (!empty($filename)) { |
|
| 77 | 77 | $builder->filename($filename); |
| 78 | 78 | } |
| 79 | - if(!empty($extension)) { |
|
| 79 | + if (!empty($extension)) { |
|
| 80 | 80 | $builder->extension($extension); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -91,21 +91,21 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function upload(string $destinationFilename, string $sourceFilename): void |
| 93 | 93 | { |
| 94 | - if(empty($destinationFilename)) { |
|
| 94 | + if (empty($destinationFilename)) { |
|
| 95 | 95 | throw new \InvalidArgumentException("Destination filename should not be empty"); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if(empty($sourceFilename)) { |
|
| 98 | + if (empty($sourceFilename)) { |
|
| 99 | 99 | throw new \InvalidArgumentException("Source filename should not be empty"); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if(!is_readable($sourceFilename)) { |
|
| 102 | + if (!is_readable($sourceFilename)) { |
|
| 103 | 103 | throw new \RuntimeException('Source file is not readable'); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $fileHandler = fopen($sourceFilename, 'r'); |
| 107 | 107 | |
| 108 | - if(!$fileHandler) { |
|
| 108 | + if (!$fileHandler) { |
|
| 109 | 109 | throw new \RuntimeException('Could not read source file'); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } catch (RequestException $e) { |
| 117 | 117 | throw new Exception('Upload exception: ' . $e->getMessage(), 0, $e); |
| 118 | 118 | } finally { |
| 119 | - if(is_resource($fileHandler)) { |
|
| 119 | + if (is_resource($fileHandler)) { |
|
| 120 | 120 | fclose($fileHandler); |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function remove(string $filename): void |
| 131 | 131 | { |
| 132 | - if(empty($filename)) { |
|
| 132 | + if (empty($filename)) { |
|
| 133 | 133 | throw new \InvalidArgumentException("Filename should not be empty"); |
| 134 | 134 | } |
| 135 | 135 | |