Passed
Pull Request — master (#167)
by
unknown
02:53
created
src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveApp.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             'client_secret' => $this->appSecret,
128 128
         ];
129 129
 
130
-        if(!$byRefresh){
130
+        if (!$byRefresh) {
131 131
             $params['redirect_uri'] = $redirectUrl;
132 132
         }
133 133
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
                 $refreshToken = $this->tokenService->getRefreshToken();
170 170
 
171
-                $response = $this->fetchTokens($refreshToken , '', true);
171
+                $response = $this->fetchTokens($refreshToken, '', true);
172 172
 
173 173
                 $prevHeaders['Authorization'] = 'Bearer ' . $response->access_token;
174 174
 
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
                 'Content-Type' => $contentType
200 200
             ];
201 201
             return $this->sendRequest($url, $params, $headers, $method);
202
-        }catch (Exception $e){
203
-            throw new Exception($e->getMessage(), (int)$e->getCode());
202
+        } catch (Exception $e) {
203
+            throw new Exception($e->getMessage(), (int) $e->getCode());
204 204
         }
205 205
     }
206 206
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      * @return mixed|null
213 213
      * @throws Exception
214 214
      */
215
-    public function getFileInfo(string $fileId, bool $media = false, array $params = []){
215
+    public function getFileInfo(string $fileId, bool $media = false, array $params = []) {
216 216
         $queryParam = $media ? '?alt=media' : '?fields=*';
217 217
         return $this->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '/' . $fileId . $queryParam, $params, 'GET');
218 218
     }
Please login to merge, or discard this patch.
src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapter.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
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']
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.