@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $bearerToken = null; |
| 94 | 94 | |
| 95 | - $authorization = (string)self::getHeader('Authorization'); |
|
| 95 | + $authorization = (string) self::getHeader('Authorization'); |
|
| 96 | 96 | |
| 97 | 97 | if (self::hasHeader('Authorization') && preg_match('/Bearer\s(\S+)/', $authorization, $matches)) { |
| 98 | 98 | $bearerToken = $matches[1]; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | return null; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $authorization = (string)self::getHeader('Authorization'); |
|
| 122 | + $authorization = (string) self::getHeader('Authorization'); |
|
| 123 | 123 | |
| 124 | 124 | if (preg_match('/Basic\s(\S+)/', $authorization, $matches)) { |
| 125 | 125 | $decoded = base64_decode($matches[1], true); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | return [ |
| 74 | 74 | filter_var(config()->get('lang.enabled'), FILTER_VALIDATE_BOOLEAN), |
| 75 | - (array)config()->get('lang.supported'), |
|
| 75 | + (array) config()->get('lang.supported'), |
|
| 76 | 76 | config()->get('lang.default'), |
| 77 | 77 | ]; |
| 78 | 78 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | private static function getLangFromUrlSegment(array $supported): ?string |
| 125 | 125 | { |
| 126 | - $segmentIndex = (int)config()->get('lang.url_segment'); |
|
| 126 | + $segmentIndex = (int) config()->get('lang.url_segment'); |
|
| 127 | 127 | |
| 128 | 128 | if (!in_array(route_prefix(), [null, '', '0'], true) && $segmentIndex === 1) { |
| 129 | 129 | $segmentIndex++; |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | 'Content-Type' => $contentType |
| 194 | 194 | ]; |
| 195 | 195 | return $this->sendRequest($url, $params, $headers, $method); |
| 196 | - }catch (Exception $e){ |
|
| 197 | - throw new Exception($e->getMessage(), (int)$e->getCode(), $e); |
|
| 196 | + } catch (Exception $e) { |
|
| 197 | + throw new Exception($e->getMessage(), (int) $e->getCode(), $e); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @return mixed|null |
| 207 | 207 | * @throws Exception |
| 208 | 208 | */ |
| 209 | - public function getFileInfo(string $fileId, bool $media = false, array $params = []){ |
|
| 209 | + public function getFileInfo(string $fileId, bool $media = false, array $params = []) { |
|
| 210 | 210 | $queryParam = $media ? '?alt=media' : '?fields=*'; |
| 211 | 211 | return $this->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '/' . $fileId . $queryParam, $params, 'GET'); |
| 212 | 212 | } |
@@ -193,7 +193,7 @@ |
||
| 193 | 193 | 'Content-Type' => $contentType |
| 194 | 194 | ]; |
| 195 | 195 | return $this->sendRequest($url, $params, $headers, $method); |
| 196 | - }catch (Exception $e){ |
|
| 196 | + } catch (Exception $e){ |
|
| 197 | 197 | throw new Exception($e->getMessage(), (int)$e->getCode(), $e); |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function makeDirectory(string $dirname, ?string $parentId = null): bool |
| 44 | 44 | { |
| 45 | - try{ |
|
| 45 | + try { |
|
| 46 | 46 | $data = [ |
| 47 | 47 | 'name' => $dirname, |
| 48 | 48 | 'mimeType' => GoogleDriveApp::FOLDER_MIMETYPE, |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function get(string $filename) |
| 71 | 71 | { |
| 72 | 72 | try { |
| 73 | - return (string)$this->googleDriveApp->getFileInfo($filename, true); |
|
| 73 | + return (string) $this->googleDriveApp->getFileInfo($filename, true); |
|
| 74 | 74 | } catch (Exception $e) { |
| 75 | 75 | return false; |
| 76 | 76 | } |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | public function put(string $filename, string $content, ?string $parentId = null) |
| 83 | 83 | { |
| 84 | 84 | try { |
| 85 | - if($this->isFile($filename)){ |
|
| 85 | + if ($this->isFile($filename)) { |
|
| 86 | 86 | return $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_MEDIA_URL . '/' . $filename . '?uploadType=media', $content, 'PATCH', 'application/octet-stream'); |
| 87 | - }else{ |
|
| 87 | + } else { |
|
| 88 | 88 | $data = [ |
| 89 | 89 | 'name' => $filename, |
| 90 | 90 | 'parents' => $parentId ? [$parentId] : ['root'] |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | public function size(string $filename) |
| 158 | 158 | { |
| 159 | 159 | try { |
| 160 | - $meta = (array)$this->googleDriveApp->getFileInfo($filename); |
|
| 160 | + $meta = (array) $this->googleDriveApp->getFileInfo($filename); |
|
| 161 | 161 | return $meta['size']; |
| 162 | 162 | } catch (Exception $e) { |
| 163 | 163 | return false; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | public function lastModified(string $filename) |
| 171 | 171 | { |
| 172 | 172 | try { |
| 173 | - $meta = (array)$this->googleDriveApp->getFileInfo($filename); |
|
| 173 | + $meta = (array) $this->googleDriveApp->getFileInfo($filename); |
|
| 174 | 174 | return empty($meta['modifiedTime']) ? false : strtotime($meta['modifiedTime']); |
| 175 | 175 | } catch (Exception $e) { |
| 176 | 176 | return false; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | public function isFile(string $filename): bool |
| 199 | 199 | { |
| 200 | 200 | try { |
| 201 | - $meta = (array)$this->googleDriveApp->getFileInfo($filename); |
|
| 201 | + $meta = (array) $this->googleDriveApp->getFileInfo($filename); |
|
| 202 | 202 | |
| 203 | 203 | return $meta['kind'] === GoogleDriveApp::DRIVE_FILE_KIND && $meta['mimeType'] != GoogleDriveApp::FOLDER_MIMETYPE; |
| 204 | 204 | } catch (Exception $e) { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | public function isDirectory(string $dirname): bool |
| 213 | 213 | { |
| 214 | 214 | try { |
| 215 | - $meta = (array)$this->googleDriveApp->getFileInfo($dirname); |
|
| 215 | + $meta = (array) $this->googleDriveApp->getFileInfo($dirname); |
|
| 216 | 216 | |
| 217 | 217 | return $meta['kind'] === GoogleDriveApp::DRIVE_FILE_KIND && $meta['mimeType'] === GoogleDriveApp::FOLDER_MIMETYPE; |
| 218 | 218 | } catch (Exception $e) { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | 'q' => "'$dirname' in parents and trashed = false", |
| 231 | 231 | 'fields' => '*' |
| 232 | 232 | ]; |
| 233 | - $response = (array)$this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '?' . http_build_query($params), [], 'GET'); |
|
| 233 | + $response = (array) $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '?' . http_build_query($params), [], 'GET'); |
|
| 234 | 234 | return $response["files"]; |
| 235 | 235 | } catch (Exception $e) { |
| 236 | 236 | return false; |
@@ -381,7 +381,7 @@ |
||
| 381 | 381 | protected function moveUploadedFile(string $filePath): bool |
| 382 | 382 | { |
| 383 | 383 | if ($this->remoteFileSystem) { |
| 384 | - return (bool)$this->remoteFileSystem->put($filePath, $this->localFileSystem->get($this->getPathname())); |
|
| 384 | + return (bool) $this->remoteFileSystem->put($filePath, $this->localFileSystem->get($this->getPathname())); |
|
| 385 | 385 | } elseif ($this->isUploaded()) { |
| 386 | 386 | return move_uploaded_file($this->getPathname(), $filePath); |
| 387 | 387 | } else { |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | |
| 62 | 62 | $currentMiddleware = $this->getMiddleware($request, $response); |
| 63 | 63 | |
| 64 | - [$request, $response] = $currentMiddleware->apply($request, $response, function ($request, $response) { |
|
| 64 | + [$request, $response] = $currentMiddleware->apply($request, $response, function($request, $response) { |
|
| 65 | 65 | next($this->middlewares); |
| 66 | 66 | return [$request, $response]; |
| 67 | 67 | }); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | function _message(string $subject, $params): string |
| 25 | 25 | { |
| 26 | 26 | if (is_array($params)) { |
| 27 | - return preg_replace_callback('/{%\d+}/', function () use (&$params) { |
|
| 27 | + return preg_replace_callback('/{%\d+}/', function() use (&$params) { |
|
| 28 | 28 | return array_shift($params); |
| 29 | 29 | }, $subject); |
| 30 | 30 | } else { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | for ($i = 0; $i < $length; $i++) { |
| 60 | 60 | $randomString .= random_int(0, 9); |
| 61 | 61 | } |
| 62 | - return (int)$randomString; |
|
| 62 | + return (int) $randomString; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | ->offset($this->perPage * ($this->page - 1)) |
| 63 | 63 | ->get(); |
| 64 | 64 | |
| 65 | - if($this->modelClass != '@anonymous') { |
|
| 65 | + if ($this->modelClass != '@anonymous') { |
|
| 66 | 66 | $result = array_map(fn($item) => wrapToModel($item->getOrmInstance(), $this->modelClass), iterator_to_array($result)); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | return; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $step = (int)$this->getOption('step') ?: null; |
|
| 79 | + $step = (int) $this->getOption('step') ?: null; |
|
| 80 | 80 | |
| 81 | 81 | $migrationManager = new MigrationManager(); |
| 82 | 82 | |