@@ -362,7 +362,7 @@ |
||
362 | 362 | protected function moveUploadedFile(string $filePath): bool |
363 | 363 | { |
364 | 364 | if ($this->remoteFileSystem) { |
365 | - return (bool)$this->remoteFileSystem->put($filePath, $this->localFileSystem->get($this->getPathname())); |
|
365 | + return (bool) $this->remoteFileSystem->put($filePath, $this->localFileSystem->get($this->getPathname())); |
|
366 | 366 | } else { |
367 | 367 | if ($this->isUploaded()) { |
368 | 368 | return move_uploaded_file($this->getPathname(), $filePath); |
@@ -85,7 +85,7 @@ |
||
85 | 85 | */ |
86 | 86 | private function generateRandomKey(): string |
87 | 87 | { |
88 | - return bin2hex(random_bytes((int)$this->getOption('length'))); |
|
88 | + return bin2hex(random_bytes((int) $this->getOption('length'))); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | { |
210 | 210 | $lines = file($filename, FILE_IGNORE_NEW_LINES); |
211 | 211 | |
212 | - if(!$lines) { |
|
212 | + if (!$lines) { |
|
213 | 213 | return []; |
214 | 214 | } |
215 | 215 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function fileName(string $path): string |
229 | 229 | { |
230 | - return (string)pathinfo($path, PATHINFO_FILENAME); |
|
230 | + return (string) pathinfo($path, PATHINFO_FILENAME); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function extension(string $path): string |
239 | 239 | { |
240 | - return (string)pathinfo($path, PATHINFO_EXTENSION); |
|
240 | + return (string) pathinfo($path, PATHINFO_EXTENSION); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -124,8 +124,9 @@ |
||
124 | 124 | */ |
125 | 125 | public function verify(string $code): bool |
126 | 126 | { |
127 | - if (is_null($this->secretKey)) |
|
128 | - throw new Exception('The secret key is not set'); |
|
127 | + if (is_null($this->secretKey)) { |
|
128 | + throw new Exception('The secret key is not set'); |
|
129 | + } |
|
129 | 130 | |
130 | 131 | if (empty($code)) { |
131 | 132 | $this->errorCodes = ['internal-empty-response']; |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public function get(): array |
42 | 42 | { |
43 | - return array_map(function ($element) { |
|
43 | + return array_map(function($element) { |
|
44 | 44 | $item = clone $this; |
45 | 45 | $item->data = $element; |
46 | 46 | $item->modifiedFields = $element; |
@@ -137,7 +137,7 @@ |
||
137 | 137 | */ |
138 | 138 | public function lastPageNumber(): int |
139 | 139 | { |
140 | - return (int)ceil($this->total() / $this->perPage); |
|
140 | + return (int) ceil($this->total() / $this->perPage); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | * @param string $key |
33 | 33 | * @return bool |
34 | 34 | */ |
35 | - public static function hasHeader(string $key): bool |
|
36 | - { |
|
37 | - list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key); |
|
35 | + public static function hasHeader(string $key): bool |
|
36 | + { |
|
37 | + list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key); |
|
38 | 38 | |
39 | - return isset(self::$__headers[$keyWithHyphens]) || isset(self::$__headers[$keyWithUnderscores]); |
|
40 | - } |
|
39 | + return isset(self::$__headers[$keyWithHyphens]) || isset(self::$__headers[$keyWithUnderscores]); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Gets the request header by given key |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public static function getHeader(string $key): ?string |
48 | 48 | { |
49 | - if (self::hasHeader($key)) { |
|
50 | - list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key); |
|
51 | - return self::$__headers[$keyWithHyphens] ?? self::$__headers[$keyWithUnderscores]; |
|
52 | - } |
|
49 | + if (self::hasHeader($key)) { |
|
50 | + list($keyWithHyphens, $keyWithUnderscores) = self::normalizeHeaderKey($key); |
|
51 | + return self::$__headers[$keyWithHyphens] ?? self::$__headers[$keyWithUnderscores]; |
|
52 | + } |
|
53 | 53 | |
54 | - return null; |
|
54 | + return null; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - /** |
|
88 | - * @param string $key |
|
89 | - * @return array |
|
90 | - */ |
|
91 | - private static function normalizeHeaderKey(string $key): array |
|
92 | - { |
|
93 | - $keyWithHyphens = str_replace('_', '-', strtolower($key)); |
|
94 | - $keyWithUnderscores = str_replace('-', '_', $key); |
|
95 | - return [$keyWithHyphens, $keyWithUnderscores]; |
|
96 | - } |
|
87 | + /** |
|
88 | + * @param string $key |
|
89 | + * @return array |
|
90 | + */ |
|
91 | + private static function normalizeHeaderKey(string $key): array |
|
92 | + { |
|
93 | + $keyWithHyphens = str_replace('_', '-', strtolower($key)); |
|
94 | + $keyWithUnderscores = str_replace('-', '_', $key); |
|
95 | + return [$keyWithHyphens, $keyWithUnderscores]; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -82,9 +82,9 @@ |
||
82 | 82 | if (!empty($value)) { |
83 | 83 | $captcha = CaptchaManager::getHandler(); |
84 | 84 | |
85 | - if (!$captcha->verify($value)){ |
|
85 | + if (!$captcha->verify($value)) { |
|
86 | 86 | $errorCode = $captcha->getErrorMessage(); |
87 | - $this->addError($field, 'captcha.'.$errorCode, $param); |
|
87 | + $this->addError($field, 'captcha.' . $errorCode, $param); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -163,7 +163,7 @@ |
||
163 | 163 | 'Content-Type' => $contentType |
164 | 164 | ]; |
165 | 165 | return $this->sendRequest($url, $params, $headers, $method); |
166 | - }catch (Exception $e){ |
|
166 | + } catch (Exception $e){ |
|
167 | 167 | throw new Exception($e->getMessage(), (int)$e->getCode()); |
168 | 168 | } |
169 | 169 | } |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | 'Content-Type' => $contentType |
218 | 218 | ]; |
219 | 219 | return $this->sendRequest($url, $params, $headers, $method); |
220 | - }catch (Exception $e){ |
|
221 | - throw new Exception($e->getMessage(), (int)$e->getCode()); |
|
220 | + } catch (Exception $e) { |
|
221 | + throw new Exception($e->getMessage(), (int) $e->getCode()); |
|
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return mixed|null |
231 | 231 | * @throws Exception |
232 | 232 | */ |
233 | - public function getFileInfo(string $fileId, bool $media = false, array $params = []){ |
|
233 | + public function getFileInfo(string $fileId, bool $media = false, array $params = []) { |
|
234 | 234 | $queryParam = $media ? '?alt=media' : '?fields=*'; |
235 | 235 | return $this->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '/' . $fileId . $queryParam, $params, 'GET'); |
236 | 236 | } |