@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | $backend = $input->getArgument('backend'); |
72 | 72 | if ($type) { |
73 | 73 | if (!isset($data[$type])) { |
74 | - $output->writeln('<error>Invalid type "' . $type . '". Possible values are "authentication" or "storage"</error>'); |
|
74 | + $output->writeln('<error>Invalid type "'.$type.'". Possible values are "authentication" or "storage"</error>'); |
|
75 | 75 | return 1; |
76 | 76 | } |
77 | 77 | $data = $data[$type]; |
78 | 78 | |
79 | 79 | if ($backend) { |
80 | 80 | if (!isset($data[$backend])) { |
81 | - $output->writeln('<error>Unknown backend "' . $backend . '" of type "' . $type . '"</error>'); |
|
81 | + $output->writeln('<error>Unknown backend "'.$backend.'" of type "'.$type.'"</error>'); |
|
82 | 82 | return 1; |
83 | 83 | } |
84 | 84 | $data = $data[$backend]; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $result['storage_class'] = $backend->getStorageClass(); |
100 | 100 | $authBackends = $this->backendService->getAuthMechanismsByScheme(array_keys($backend->getAuthSchemes())); |
101 | 101 | $result['supported_authentication_backends'] = array_keys($authBackends); |
102 | - $authConfig = array_map(function (AuthMechanism $auth) { |
|
102 | + $authConfig = array_map(function(AuthMechanism $auth) { |
|
103 | 103 | return $this->serializeAuthBackend($auth)['configuration']; |
104 | 104 | }, $authBackends); |
105 | 105 | $result['authentication_configuration'] = array_combine(array_keys($authBackends), $authConfig); |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | * @return string[] |
113 | 113 | */ |
114 | 114 | private function formatConfiguration(array $parameters) { |
115 | - $configuration = array_filter($parameters, function (DefinitionParameter $parameter) { |
|
115 | + $configuration = array_filter($parameters, function(DefinitionParameter $parameter) { |
|
116 | 116 | return $parameter->getType() !== DefinitionParameter::VALUE_HIDDEN; |
117 | 117 | }); |
118 | - return array_map(function (DefinitionParameter $parameter) { |
|
118 | + return array_map(function(DefinitionParameter $parameter) { |
|
119 | 119 | return $parameter->getTypeName(); |
120 | 120 | }, $configuration); |
121 | 121 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $json = file_get_contents('php://stdin'); |
113 | 113 | } else { |
114 | 114 | if (!file_exists($path)) { |
115 | - $output->writeln('<error>File not found: ' . $path . '</error>'); |
|
115 | + $output->writeln('<error>File not found: '.$path.'</error>'); |
|
116 | 116 | return 1; |
117 | 117 | } |
118 | 118 | $json = file_get_contents($path); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $existingMount->getApplicableUsers() == $mount->getApplicableUsers() && |
165 | 165 | $existingMount->getBackendOptions() == $mount->getBackendOptions() |
166 | 166 | ) { |
167 | - $output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>"); |
|
167 | + $output->writeln("<error>Duplicate mount (".$mount->getMountPoint().")</error>"); |
|
168 | 168 | return 1; |
169 | 169 | } |
170 | 170 | } |
@@ -140,7 +140,7 @@ |
||
140 | 140 | * @return bool |
141 | 141 | */ |
142 | 142 | public function isFlagSet($flag) { |
143 | - return (bool)($this->flags & $flag); |
|
143 | + return (bool) ($this->flags & $flag); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -51,7 +51,7 @@ |
||
51 | 51 | ->addParameters([]); |
52 | 52 | } |
53 | 53 | |
54 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
54 | + public function manipulateStorageConfig(StorageConfig & $storage, IUser $user = null) { |
|
55 | 55 | try { |
56 | 56 | $credentials = $this->credentialsStore->getLoginCredentials(); |
57 | 57 | } catch (CredentialsUnavailableException $e) { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | $this->credentialsManager->store($userId, self::CREDENTIALS_IDENTIFIER, $credentials); |
76 | 76 | } |
77 | 77 | |
78 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
78 | + public function manipulateStorageConfig(StorageConfig & $storage, IUser $user = null) { |
|
79 | 79 | if (!isset($user)) { |
80 | 80 | throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved'); |
81 | 81 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | private function getCredentialsIdentifier($storageId) { |
64 | - return self::CREDENTIALS_IDENTIFIER_PREFIX . $storageId; |
|
64 | + return self::CREDENTIALS_IDENTIFIER_PREFIX.$storageId; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function saveBackendOptions(IUser $user, $id, array $options) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | ]); |
72 | 72 | } |
73 | 73 | |
74 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
74 | + public function manipulateStorageConfig(StorageConfig & $storage, IUser $user = null) { |
|
75 | 75 | if (!isset($user)) { |
76 | 76 | throw new InsufficientDataForMeaningfulAnswerException('No credentials saved'); |
77 | 77 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | ]); |
71 | 71 | } |
72 | 72 | |
73 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
73 | + public function manipulateStorageConfig(StorageConfig & $storage, IUser $user = null) { |
|
74 | 74 | if ($storage->getType() === StorageConfig::MOUNT_TYPE_ADMIN) { |
75 | 75 | $uid = ''; |
76 | 76 | } elseif (is_null($user)) { |
@@ -57,7 +57,7 @@ |
||
57 | 57 | ; |
58 | 58 | } |
59 | 59 | |
60 | - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { |
|
60 | + public function manipulateStorageConfig(StorageConfig & $storage, IUser $user = null) { |
|
61 | 61 | $auth = new RSACrypt(); |
62 | 62 | $auth->setPassword($this->config->getSystemValue('secret', '')); |
63 | 63 | if (!$auth->loadKey($storage->getBackendOption('private_key'))) { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if (isset($this->driveFiles[$path])) { |
124 | 124 | $parentId = $this->driveFiles[$path]->getId(); |
125 | 125 | } else { |
126 | - $q = "title='" . str_replace("'","\\'", $name) . "' and '" . str_replace("'","\\'", $parentId) . "' in parents and trashed = false"; |
|
126 | + $q = "title='".str_replace("'", "\\'", $name)."' and '".str_replace("'", "\\'", $parentId)."' in parents and trashed = false"; |
|
127 | 127 | $result = $this->service->files->listFiles(array('q' => $q))->getItems(); |
128 | 128 | if (!empty($result)) { |
129 | 129 | // Google Drive allows files with the same name, ownCloud doesn't |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | if ($result) { |
237 | 237 | $this->setDriveFile($path, $result); |
238 | 238 | } |
239 | - return (bool)$result; |
|
239 | + return (bool) $result; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | return false; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | } |
249 | 249 | if (trim($path, '/') === '') { |
250 | 250 | $dir = $this->opendir($path); |
251 | - if(is_resource($dir)) { |
|
251 | + if (is_resource($dir)) { |
|
252 | 252 | while (($file = readdir($dir)) !== false) { |
253 | 253 | if (!\OC\Files\Filesystem::isIgnoredDir($file)) { |
254 | 254 | if (!$this->unlink($path.'/'.$file)) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | if ($pageToken !== true) { |
277 | 277 | $params['pageToken'] = $pageToken; |
278 | 278 | } |
279 | - $params['q'] = "'" . str_replace("'","\\'", $folder->getId()) . "' in parents and trashed = false"; |
|
279 | + $params['q'] = "'".str_replace("'", "\\'", $folder->getId())."' in parents and trashed = false"; |
|
280 | 280 | $children = $this->service->files->listFiles($params); |
281 | 281 | foreach ($children->getItems() as $child) { |
282 | 282 | $name = $child->getTitle(); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | public function file_exists($path) { |
372 | - return (bool)$this->getDriveFile($path); |
|
372 | + return (bool) $this->getDriveFile($path); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | public function unlink($path) { |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | if ($result) { |
380 | 380 | $this->setDriveFile($path, false); |
381 | 381 | } |
382 | - return (bool)$result; |
|
382 | + return (bool) $result; |
|
383 | 383 | } else { |
384 | 384 | return false; |
385 | 385 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | } |
428 | 428 | } |
429 | 429 | } |
430 | - return (bool)$result; |
|
430 | + return (bool) $result; |
|
431 | 431 | } else { |
432 | 432 | return false; |
433 | 433 | } |
@@ -462,10 +462,10 @@ discard block |
||
462 | 462 | $response = $client->get($downloadUrl, [ |
463 | 463 | 'headers' => $httpRequest->getRequestHeaders(), |
464 | 464 | 'stream' => true, |
465 | - 'verify' => realpath(__DIR__ . '/../../../3rdparty/google-api-php-client/src/Google/IO/cacerts.pem'), |
|
465 | + 'verify' => realpath(__DIR__.'/../../../3rdparty/google-api-php-client/src/Google/IO/cacerts.pem'), |
|
466 | 466 | ]); |
467 | 467 | } catch (RequestException $e) { |
468 | - if(!is_null($e->getResponse())) { |
|
468 | + if (!is_null($e->getResponse())) { |
|
469 | 469 | if ($e->getResponse()->getStatusCode() === 404) { |
470 | 470 | return false; |
471 | 471 | } else { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | file_put_contents($tmpFile, $source); |
500 | 500 | } |
501 | 501 | $handle = fopen($tmpFile, $mode); |
502 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
502 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
503 | 503 | $this->writeBack($tmpFile, $path); |
504 | 504 | }); |
505 | 505 | } |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | if ($result) { |
642 | 642 | $this->setDriveFile($path, $result); |
643 | 643 | } |
644 | - return (bool)$result; |
|
644 | + return (bool) $result; |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | public function test() { |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | 'includeSubscribed' => true, |
669 | 669 | ); |
670 | 670 | if (isset($startChangeId)) { |
671 | - $startChangeId = (int)$startChangeId; |
|
671 | + $startChangeId = (int) $startChangeId; |
|
672 | 672 | $largestChangeId = $startChangeId; |
673 | 673 | $params['startChangeId'] = $startChangeId + 1; |
674 | 674 | } else { |