@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | $error = false; |
43 | 43 | |
44 | 44 | if (function_exists('mb_strlen')) { |
45 | - if (mb_strlen($value) < (int)$param) { |
|
45 | + if (mb_strlen($value) < (int) $param) { |
|
46 | 46 | $error = true; |
47 | 47 | } |
48 | 48 | } else { |
49 | - if (strlen($value) < (int)$param) { |
|
49 | + if (strlen($value) < (int) $param) { |
|
50 | 50 | $error = true; |
51 | 51 | } |
52 | 52 | } |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | $error = false; |
71 | 71 | |
72 | 72 | if (function_exists('mb_strlen')) { |
73 | - if (mb_strlen($value) > (int)$param) { |
|
73 | + if (mb_strlen($value) > (int) $param) { |
|
74 | 74 | $error = true; |
75 | 75 | } |
76 | 76 | } else { |
77 | - if (strlen($value) > (int)$param) { |
|
77 | + if (strlen($value) > (int) $param) { |
|
78 | 78 | $error = true; |
79 | 79 | } |
80 | 80 | } |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | $error = false; |
100 | 100 | |
101 | 101 | if (function_exists('mb_strlen')) { |
102 | - if (mb_strlen($value) !== (int)$param) { |
|
102 | + if (mb_strlen($value) !== (int) $param) { |
|
103 | 103 | $error = true; |
104 | 104 | } |
105 | 105 | } else { |
106 | - if (strlen($value) !== (int)$param) { |
|
106 | + if (strlen($value) !== (int) $param) { |
|
107 | 107 | $error = true; |
108 | 108 | } |
109 | 109 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | protected function containsList(string $field, string $value, array $param) |
63 | 63 | { |
64 | 64 | if (!empty($value)) { |
65 | - $param = array_map(function ($param) { |
|
65 | + $param = array_map(function($param) { |
|
66 | 66 | return trim(strtolower($param)); |
67 | 67 | }, $param); |
68 | 68 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | protected function doesntContainsList(string $field, string $value, array $param) |
84 | 84 | { |
85 | 85 | if (!empty($value)) { |
86 | - $param = array_map(function ($param) { |
|
86 | + $param = array_map(function($param) { |
|
87 | 87 | return trim(strtolower($param)); |
88 | 88 | }, $param); |
89 | 89 |
@@ -196,7 +196,7 @@ |
||
196 | 196 | foreach ($this->errors as $field => $errors) { |
197 | 197 | if (count($errors)) { |
198 | 198 | foreach ($errors as $rule => $param) { |
199 | - $translationParams = [t('common.'.$field)]; |
|
199 | + $translationParams = [t('common.' . $field)]; |
|
200 | 200 | |
201 | 201 | if ($param) { |
202 | 202 | $translationParams[] = $param; |
@@ -74,7 +74,7 @@ |
||
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - $step = (int)$this->getOption('step') ?: null; |
|
77 | + $step = (int) $this->getOption('step') ?: null; |
|
78 | 78 | |
79 | 79 | $migrationManager = new MigrationManager(); |
80 | 80 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function get(string $filename) |
89 | 89 | { |
90 | 90 | try { |
91 | - return (string)$this->dropboxApp->contentRequest(DropboxApp::ENDPOINT_DOWNLOAD_FILE, $this->dropboxApp->path($filename)); |
|
91 | + return (string) $this->dropboxApp->contentRequest(DropboxApp::ENDPOINT_DOWNLOAD_FILE, $this->dropboxApp->path($filename)); |
|
92 | 92 | } catch (Exception $e) { |
93 | 93 | return false; |
94 | 94 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | public function size(string $filename) |
169 | 169 | { |
170 | 170 | try { |
171 | - $meta = (array)$this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_FILE_METADATA, $this->dropboxApp->path($filename)); |
|
171 | + $meta = (array) $this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_FILE_METADATA, $this->dropboxApp->path($filename)); |
|
172 | 172 | return $meta['size']; |
173 | 173 | } catch (Exception $e) { |
174 | 174 | return false; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | public function lastModified(string $filename) |
182 | 182 | { |
183 | 183 | try { |
184 | - $meta = (array)$this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_FILE_METADATA, $this->dropboxApp->path($filename)); |
|
184 | + $meta = (array) $this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_FILE_METADATA, $this->dropboxApp->path($filename)); |
|
185 | 185 | return isset($meta['server_modified']) ? strtotime($meta['server_modified']) : false; |
186 | 186 | } catch (Exception $e) { |
187 | 187 | return false; |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | public function isFile(string $filename): bool |
210 | 210 | { |
211 | 211 | try { |
212 | - $meta = (array)$this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_FILE_METADATA, $this->dropboxApp->path($filename)); |
|
212 | + $meta = (array) $this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_FILE_METADATA, $this->dropboxApp->path($filename)); |
|
213 | 213 | return $meta['.tag'] == 'file'; |
214 | 214 | } catch (Exception $e) { |
215 | 215 | return false; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | public function isDirectory(string $dirname): bool |
224 | 224 | { |
225 | 225 | try { |
226 | - $meta = (array)$this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_FILE_METADATA, $this->dropboxApp->path($dirname)); |
|
226 | + $meta = (array) $this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_FILE_METADATA, $this->dropboxApp->path($dirname)); |
|
227 | 227 | return $meta['.tag'] == 'folder'; |
228 | 228 | } catch (Exception $e) { |
229 | 229 | return false; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | public function listDirectory(string $dirname) |
237 | 237 | { |
238 | 238 | try { |
239 | - $response = (array)$this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_LIST_FOLDER, $this->dropboxApp->path($dirname)); |
|
239 | + $response = (array) $this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_LIST_FOLDER, $this->dropboxApp->path($dirname)); |
|
240 | 240 | return $response['entries']; |
241 | 241 | } catch (Exception $e) { |
242 | 242 | return false; |
@@ -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 | } |
@@ -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 | } |
@@ -82,7 +82,7 @@ |
||
82 | 82 | try { |
83 | 83 | if($this->isFile($filename)){ |
84 | 84 | return $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_MEDIA_URL . '/' . $filename . '?uploadType=media', $content, 'PATCH', 'application/octet-stream'); |
85 | - }else{ |
|
85 | + } else{ |
|
86 | 86 | $data = [ |
87 | 87 | 'name' => $filename, |
88 | 88 | 'parents' => $parentId ? [$parentId] : ['root'] |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function makeDirectory(string $dirname, ?string $parentId = null): bool |
48 | 48 | { |
49 | - try{ |
|
49 | + try { |
|
50 | 50 | $data = [ |
51 | 51 | 'name' => $dirname, |
52 | 52 | 'mimeType' => GoogleDriveApp::FOLDER_MIMETYPE, |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function get(string $filename) |
75 | 75 | { |
76 | 76 | try { |
77 | - return (string)$this->googleDriveApp->getFileInfo($filename, true); |
|
77 | + return (string) $this->googleDriveApp->getFileInfo($filename, true); |
|
78 | 78 | } catch (Exception $e) { |
79 | 79 | return false; |
80 | 80 | } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | public function put(string $filename, string $content, ?string $parentId = null) |
87 | 87 | { |
88 | 88 | try { |
89 | - if($this->isFile($filename)){ |
|
89 | + if ($this->isFile($filename)) { |
|
90 | 90 | return $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_MEDIA_URL . '/' . $filename . '?uploadType=media', $content, 'PATCH', 'application/octet-stream'); |
91 | - }else{ |
|
91 | + } else { |
|
92 | 92 | $data = [ |
93 | 93 | 'name' => $filename, |
94 | 94 | 'parents' => $parentId ? [$parentId] : ['root'] |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | public function size(string $filename) |
162 | 162 | { |
163 | 163 | try { |
164 | - $meta = (array)$this->googleDriveApp->getFileInfo($filename); |
|
164 | + $meta = (array) $this->googleDriveApp->getFileInfo($filename); |
|
165 | 165 | return $meta['size']; |
166 | 166 | } catch (Exception $e) { |
167 | 167 | return false; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function lastModified(string $filename) |
175 | 175 | { |
176 | 176 | try { |
177 | - $meta = (array)$this->googleDriveApp->getFileInfo($filename); |
|
177 | + $meta = (array) $this->googleDriveApp->getFileInfo($filename); |
|
178 | 178 | return !empty($meta['modifiedTime']) ? strtotime($meta['modifiedTime']) : false; |
179 | 179 | } catch (Exception $e) { |
180 | 180 | return false; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | public function isFile(string $filename): bool |
203 | 203 | { |
204 | 204 | try { |
205 | - $meta = (array)$this->googleDriveApp->getFileInfo($filename); |
|
205 | + $meta = (array) $this->googleDriveApp->getFileInfo($filename); |
|
206 | 206 | |
207 | 207 | return $meta['kind'] === GoogleDriveApp::DRIVE_FILE_KIND && $meta['mimeType'] != GoogleDriveApp::FOLDER_MIMETYPE; |
208 | 208 | } catch (Exception $e) { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | public function isDirectory(string $dirname): bool |
217 | 217 | { |
218 | 218 | try { |
219 | - $meta = (array)$this->googleDriveApp->getFileInfo($dirname); |
|
219 | + $meta = (array) $this->googleDriveApp->getFileInfo($dirname); |
|
220 | 220 | |
221 | 221 | return $meta['kind'] === GoogleDriveApp::DRIVE_FILE_KIND && $meta['mimeType'] === GoogleDriveApp::FOLDER_MIMETYPE; |
222 | 222 | } catch (Exception $e) { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | 'q' => "'$dirname' in parents and trashed = false", |
235 | 235 | 'fields' => '*' |
236 | 236 | ]; |
237 | - $response = (array)$this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '?' . http_build_query($params), [], 'GET'); |
|
237 | + $response = (array) $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '?' . http_build_query($params), [], 'GET'); |
|
238 | 238 | return $response["files"]; |
239 | 239 | } catch (Exception $e) { |
240 | 240 | return false; |