@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function getGroups(string $search = '', int $limit = null, int $offset = 0): DataResponse { |
95 | 95 | $groups = $this->groupManager->search($search, $limit, $offset); |
96 | - $groups = array_map(function ($group) { |
|
96 | + $groups = array_map(function($group) { |
|
97 | 97 | /** @var IGroup $group */ |
98 | 98 | return $group->getGID(); |
99 | 99 | }, $groups); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getGroupsDetails(string $search = '', int $limit = null, int $offset = 0): DataResponse { |
115 | 115 | $groups = $this->groupManager->search($search, $limit, $offset); |
116 | - $groups = array_map(function ($group) { |
|
116 | + $groups = array_map(function($group) { |
|
117 | 117 | /** @var IGroup $group */ |
118 | 118 | return [ |
119 | 119 | 'id' => $group->getGID(), |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | // Check the group exists |
158 | 158 | $group = $this->groupManager->get($groupId); |
159 | 159 | if ($group !== null) { |
160 | - $isSubadminOfGroup =$this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group); |
|
160 | + $isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminOfGroup($user, $group); |
|
161 | 161 | } else { |
162 | 162 | throw new OCSNotFoundException('The requested group could not be found'); |
163 | 163 | } |
164 | 164 | |
165 | 165 | // Check subadmin has access to this group |
166 | - if($this->groupManager->isAdmin($user->getUID()) |
|
166 | + if ($this->groupManager->isAdmin($user->getUID()) |
|
167 | 167 | || $isSubadminOfGroup) { |
168 | 168 | $users = $this->groupManager->get($groupId)->getUsers(); |
169 | - $users = array_map(function ($user) { |
|
169 | + $users = array_map(function($user) { |
|
170 | 170 | /** @var IUser $user */ |
171 | 171 | return $user->getUID(); |
172 | 172 | }, $users); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | // Check subadmin has access to this group |
204 | - if($this->groupManager->isAdmin($currentUser->getUID()) || $isSubadminOfGroup) { |
|
204 | + if ($this->groupManager->isAdmin($currentUser->getUID()) || $isSubadminOfGroup) { |
|
205 | 205 | $users = $group->searchUsers($search, $limit, $offset); |
206 | 206 | |
207 | 207 | // Extract required number |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | foreach ($users as $user) { |
210 | 210 | try { |
211 | 211 | /** @var IUser $user */ |
212 | - $userId = (string)$user->getUID(); |
|
212 | + $userId = (string) $user->getUID(); |
|
213 | 213 | $userData = $this->getUserData($userId); |
214 | 214 | // Do not insert empty entry |
215 | 215 | if (!empty($userData)) { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | // only showing its id |
220 | 220 | $usersDetails[$userId] = ['id' => $userId]; |
221 | 221 | } |
222 | - } catch(OCSNotFoundException $e) { |
|
222 | + } catch (OCSNotFoundException $e) { |
|
223 | 223 | // continue if a users ceased to exist. |
224 | 224 | } |
225 | 225 | } |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function addGroup(string $groupid): DataResponse { |
242 | 242 | // Validate name |
243 | - if(empty($groupid)) { |
|
243 | + if (empty($groupid)) { |
|
244 | 244 | $this->logger->error('Group name not supplied', ['app' => 'provisioning_api']); |
245 | 245 | throw new OCSException('Invalid group name', 101); |
246 | 246 | } |
247 | 247 | // Check if it exists |
248 | - if($this->groupManager->groupExists($groupid)){ |
|
248 | + if ($this->groupManager->groupExists($groupid)) { |
|
249 | 249 | throw new OCSException('group exists', 102); |
250 | 250 | } |
251 | 251 | $this->groupManager->createGroup($groupid); |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function deleteGroup(string $groupId): DataResponse { |
285 | 285 | // Check it exists |
286 | - if(!$this->groupManager->groupExists($groupId)){ |
|
286 | + if (!$this->groupManager->groupExists($groupId)) { |
|
287 | 287 | throw new OCSException('', 101); |
288 | - } else if($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()){ |
|
288 | + } else if ($groupId === 'admin' || !$this->groupManager->get($groupId)->delete()) { |
|
289 | 289 | // Cannot delete admin group |
290 | 290 | throw new OCSException('', 102); |
291 | 291 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | public function getSubAdminsOfGroup(string $groupId): DataResponse { |
302 | 302 | // Check group exists |
303 | 303 | $targetGroup = $this->groupManager->get($groupId); |
304 | - if($targetGroup === null) { |
|
304 | + if ($targetGroup === null) { |
|
305 | 305 | throw new OCSException('Group does not exist', 101); |
306 | 306 | } |
307 | 307 |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | protected function registerDavEntity(IEventDispatcher $dispatcher) { |
80 | - $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) { |
|
81 | - $event->addEntityCollection('files', function ($name) { |
|
82 | - $nodes = \OC::$server->getUserFolder()->getById((int)$name); |
|
80 | + $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { |
|
81 | + $event->addEntityCollection('files', function($name) { |
|
82 | + $nodes = \OC::$server->getUserFolder()->getById((int) $name); |
|
83 | 83 | return !empty($nodes); |
84 | 84 | }); |
85 | 85 | }); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | protected function registerCommentsEventHandler() { |
93 | - $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () { |
|
93 | + $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function() { |
|
94 | 94 | return $this->getContainer()->query(EventHandler::class); |
95 | 95 | }); |
96 | 96 | } |
@@ -48,25 +48,25 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function sort(array &$sortArray, array $context) { |
50 | 50 | $commenters = $this->retrieveCommentsInformation($context['itemType'], $context['itemId']); |
51 | - if(count($commenters) === 0) { |
|
51 | + if (count($commenters) === 0) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
55 | 55 | foreach ($sortArray as $type => &$byType) { |
56 | - if(!isset($commenters[$type])) { |
|
56 | + if (!isset($commenters[$type])) { |
|
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | |
60 | 60 | // at least on PHP 5.6 usort turned out to be not stable. So we add |
61 | 61 | // the current index to the value and compare it on a draw |
62 | 62 | $i = 0; |
63 | - $workArray = array_map(function ($element) use (&$i) { |
|
63 | + $workArray = array_map(function($element) use (&$i) { |
|
64 | 64 | return [$i++, $element]; |
65 | 65 | }, $byType); |
66 | 66 | |
67 | - usort($workArray, function ($a, $b) use ($commenters, $type) { |
|
67 | + usort($workArray, function($a, $b) use ($commenters, $type) { |
|
68 | 68 | $r = $this->compare($a[1], $b[1], $commenters[$type]); |
69 | - if($r === 0) { |
|
69 | + if ($r === 0) { |
|
70 | 70 | $r = $a[0] - $b[0]; |
71 | 71 | } |
72 | 72 | return $r; |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function retrieveCommentsInformation($type, $id) { |
86 | 86 | $comments = $this->commentsManager->getForObject($type, $id); |
87 | - if(count($comments) === 0) { |
|
87 | + if (count($comments) === 0) { |
|
88 | 88 | return []; |
89 | 89 | } |
90 | 90 | |
91 | 91 | $actors = []; |
92 | 92 | foreach ($comments as $comment) { |
93 | - if(!isset($actors[$comment->getActorType()])) { |
|
93 | + if (!isset($actors[$comment->getActorType()])) { |
|
94 | 94 | $actors[$comment->getActorType()] = []; |
95 | 95 | } |
96 | - if(!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
96 | + if (!isset($actors[$comment->getActorType()][$comment->getActorId()])) { |
|
97 | 97 | $actors[$comment->getActorType()][$comment->getActorId()] = 1; |
98 | 98 | } else { |
99 | 99 | $actors[$comment->getActorType()][$comment->getActorId()]++; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function getForm() { |
96 | 96 | $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing'); |
97 | 97 | $lookupServerUploadEnabled = false; |
98 | - if($federatedFileSharingEnabled) { |
|
98 | + if ($federatedFileSharingEnabled) { |
|
99 | 99 | $federatedFileSharing = \OC::$server->query(Application::class); |
100 | 100 | $shareProvider = $federatedFileSharing->getFederatedShareProvider(); |
101 | 101 | $lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled(); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | private function getGroups(IUser $user) { |
177 | 177 | $groups = array_map( |
178 | - function (IGroup $group) { |
|
178 | + function(IGroup $group) { |
|
179 | 179 | return $group->getDisplayName(); |
180 | 180 | }, |
181 | 181 | $this->groupManager->getUserGroups($user) |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | private function getLanguages(IUser $user) { |
196 | 196 | $forceLanguage = $this->config->getSystemValue('force_language', false); |
197 | - if($forceLanguage !== false) { |
|
197 | + if ($forceLanguage !== false) { |
|
198 | 198 | return []; |
199 | 199 | } |
200 | 200 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | private function getLocales(IUser $user) { |
229 | 229 | $forceLanguage = $this->config->getSystemValue('force_locale', false); |
230 | - if($forceLanguage !== false) { |
|
230 | + if ($forceLanguage !== false) { |
|
231 | 231 | return []; |
232 | 232 | } |
233 | 233 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | $localeCodes = $this->l10nFactory->findAvailableLocales(); |
241 | 241 | |
242 | - $userLocale = array_filter($localeCodes, function ($value) use ($userLocaleString) { |
|
242 | + $userLocale = array_filter($localeCodes, function($value) use ($userLocaleString) { |
|
243 | 243 | return $userLocaleString === $value['code']; |
244 | 244 | }); |
245 | 245 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $userLocale = reset($userLocale); |
249 | 249 | } |
250 | 250 | |
251 | - $localesForLanguage = array_filter($localeCodes, function ($localeCode) use ($userLang) { |
|
251 | + $localesForLanguage = array_filter($localeCodes, function($localeCode) use ($userLang) { |
|
252 | 252 | return 0 === strpos($localeCode['code'], $userLang); |
253 | 253 | }); |
254 | 254 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | default: |
286 | 286 | $message = $this->l->t('Verify'); |
287 | 287 | } |
288 | - $messageParameters[$property . 'Message'] = $message; |
|
288 | + $messageParameters[$property.'Message'] = $message; |
|
289 | 289 | } |
290 | 290 | return $messageParameters; |
291 | 291 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @param array $urlParams |
62 | 62 | */ |
63 | - public function __construct(array $urlParams=[]) { |
|
63 | + public function __construct(array $urlParams = []) { |
|
64 | 64 | parent::__construct(self::APP_ID, $urlParams); |
65 | 65 | |
66 | 66 | $container = $this->getContainer(); |
@@ -73,32 +73,32 @@ discard block |
||
73 | 73 | * Core class wrappers |
74 | 74 | */ |
75 | 75 | /** FIXME: Remove once OC_User is non-static and mockable */ |
76 | - $container->registerService('isAdmin', function () { |
|
76 | + $container->registerService('isAdmin', function() { |
|
77 | 77 | return \OC_User::isAdminUser(\OC_User::getUser()); |
78 | 78 | }); |
79 | 79 | /** FIXME: Remove once OC_SubAdmin is non-static and mockable */ |
80 | - $container->registerService('isSubAdmin', function (IContainer $c) { |
|
80 | + $container->registerService('isSubAdmin', function(IContainer $c) { |
|
81 | 81 | $userObject = \OC::$server->getUserSession()->getUser(); |
82 | 82 | $isSubAdmin = false; |
83 | - if($userObject !== null) { |
|
83 | + if ($userObject !== null) { |
|
84 | 84 | $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); |
85 | 85 | } |
86 | 86 | return $isSubAdmin; |
87 | 87 | }); |
88 | - $container->registerService('userCertificateManager', function (IContainer $c) { |
|
88 | + $container->registerService('userCertificateManager', function(IContainer $c) { |
|
89 | 89 | return $c->query('ServerContainer')->getCertificateManager(); |
90 | 90 | }, false); |
91 | - $container->registerService('systemCertificateManager', function (IContainer $c) { |
|
91 | + $container->registerService('systemCertificateManager', function(IContainer $c) { |
|
92 | 92 | return $c->query('ServerContainer')->getCertificateManager(null); |
93 | 93 | }, false); |
94 | - $container->registerService(IProvider::class, function (IContainer $c) { |
|
94 | + $container->registerService(IProvider::class, function(IContainer $c) { |
|
95 | 95 | return $c->query('ServerContainer')->query(IProvider::class); |
96 | 96 | }); |
97 | - $container->registerService(IManager::class, function (IContainer $c) { |
|
97 | + $container->registerService(IManager::class, function(IContainer $c) { |
|
98 | 98 | return $c->query('ServerContainer')->getSettingsManager(); |
99 | 99 | }); |
100 | 100 | |
101 | - $container->registerService(NewUserMailHelper::class, function (IContainer $c) { |
|
101 | + $container->registerService(NewUserMailHelper::class, function(IContainer $c) { |
|
102 | 102 | /** @var Server $server */ |
103 | 103 | $server = $c->query('ServerContainer'); |
104 | 104 | /** @var Defaults $defaults */ |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | /** @var EventDispatcherInterface $eventDispatcher */ |
121 | 121 | $eventDispatcher = $container->getServer()->getEventDispatcher(); |
122 | - $eventDispatcher->addListener('app_password_created', function (GenericEvent $event) use ($container) { |
|
122 | + $eventDispatcher->addListener('app_password_created', function(GenericEvent $event) use ($container) { |
|
123 | 123 | if (($token = $event->getSubject()) instanceof IToken) { |
124 | 124 | /** @var IActivityManager $activityManager */ |
125 | 125 | $activityManager = $container->query(IActivityManager::class); |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | Util::connectHook('OC_User', 'changeUser', $this, 'onChangeInfo'); |
149 | 149 | |
150 | 150 | $groupManager = $this->getContainer()->getServer()->getGroupManager(); |
151 | - $groupManager->listen('\OC\Group', 'postRemoveUser', [$this, 'removeUserFromGroup']); |
|
152 | - $groupManager->listen('\OC\Group', 'postAddUser', [$this, 'addUserToGroup']); |
|
151 | + $groupManager->listen('\OC\Group', 'postRemoveUser', [$this, 'removeUserFromGroup']); |
|
152 | + $groupManager->listen('\OC\Group', 'postAddUser', [$this, 'addUserToGroup']); |
|
153 | 153 | |
154 | 154 | Util::connectHook('\OCP\Config', 'js', $this, 'extendJsConfig'); |
155 | 155 | } |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | $groupsInfo->setSorting($sortGroupsBy); |
173 | 173 | list($adminGroup, $groups) = $groupsInfo->get(); |
174 | 174 | |
175 | - if(!$isLDAPUsed && $this->appManager->isEnabledForUser('user_ldap')) { |
|
176 | - $isLDAPUsed = (bool)array_reduce($this->userManager->getBackends(), function ($ldapFound, $backend) { |
|
175 | + if (!$isLDAPUsed && $this->appManager->isEnabledForUser('user_ldap')) { |
|
176 | + $isLDAPUsed = (bool) array_reduce($this->userManager->getBackends(), function($ldapFound, $backend) { |
|
177 | 177 | return $ldapFound || $backend instanceof User_Proxy; |
178 | 178 | }); |
179 | 179 | } |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | $disabledUsers = -1; |
182 | 182 | $userCount = 0; |
183 | 183 | |
184 | - if(!$isLDAPUsed) { |
|
184 | + if (!$isLDAPUsed) { |
|
185 | 185 | if ($this->isAdmin) { |
186 | 186 | $disabledUsers = $this->userManager->countDisabledUsers(); |
187 | - $userCount = array_reduce($this->userManager->countUsers(), function ($v, $w) { |
|
188 | - return $v + (int)$w; |
|
187 | + $userCount = array_reduce($this->userManager->countUsers(), function($v, $w) { |
|
188 | + return $v + (int) $w; |
|
189 | 189 | }, 0); |
190 | 190 | } else { |
191 | 191 | // User is subadmin ! |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $userGroups = $this->groupManager->getUserGroups($user); |
194 | 194 | $groupsNames = []; |
195 | 195 | |
196 | - foreach($groups as $key => $group) { |
|
196 | + foreach ($groups as $key => $group) { |
|
197 | 197 | // $userCount += (int)$group['usercount']; |
198 | 198 | array_push($groupsNames, $group['name']); |
199 | 199 | // we prevent subadmins from looking up themselves |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | protected function canAdminChangeUserPasswords() { |
295 | 295 | $isEncryptionEnabled = $this->encryptionManager->isEnabled(); |
296 | 296 | try { |
297 | - $noUserSpecificEncryptionKeys =!$this->encryptionManager->getEncryptionModule()->needDetailedAccessList(); |
|
297 | + $noUserSpecificEncryptionKeys = !$this->encryptionManager->getEncryptionModule()->needDetailedAccessList(); |
|
298 | 298 | $isEncryptionModuleLoaded = true; |
299 | 299 | } catch (ModuleDoesNotExistsException $e) { |
300 | 300 | $noUserSpecificEncryptionKeys = true; |
301 | 301 | $isEncryptionModuleLoaded = false; |
302 | 302 | } |
303 | 303 | |
304 | - $canChangePassword = ($isEncryptionEnabled && $isEncryptionModuleLoaded && $noUserSpecificEncryptionKeys) |
|
304 | + $canChangePassword = ($isEncryptionEnabled && $isEncryptionModuleLoaded && $noUserSpecificEncryptionKeys) |
|
305 | 305 | || (!$isEncryptionEnabled && !$isEncryptionModuleLoaded) |
306 | 306 | || (!$isEncryptionEnabled && $isEncryptionModuleLoaded && $noUserSpecificEncryptionKeys); |
307 | 307 | |
@@ -456,11 +456,11 @@ discard block |
||
456 | 456 | |
457 | 457 | $accountData = $this->accountManager->getUser($user); |
458 | 458 | $cloudId = $user->getCloudId(); |
459 | - $message = 'Use my Federated Cloud ID to share with me: ' . $cloudId; |
|
459 | + $message = 'Use my Federated Cloud ID to share with me: '.$cloudId; |
|
460 | 460 | $signature = $this->signMessage($user, $message); |
461 | 461 | |
462 | - $code = $message . ' ' . $signature; |
|
463 | - $codeMd5 = $message . ' ' . md5($signature); |
|
462 | + $code = $message.' '.$signature; |
|
463 | + $codeMd5 = $message.' '.md5($signature); |
|
464 | 464 | |
465 | 465 | switch ($account) { |
466 | 466 | case 'verify-twitter': |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | private function getAppsWithUpdates() { |
150 | 150 | $appClass = new \OC_App(); |
151 | 151 | $apps = $appClass->listAllApps(); |
152 | - foreach($apps as $key => $app) { |
|
152 | + foreach ($apps as $key => $app) { |
|
153 | 153 | $newVersion = $this->installer->isUpdateAvailable($app['id']); |
154 | - if($newVersion === false) { |
|
154 | + if ($newVersion === false) { |
|
155 | 155 | unset($apps[$key]); |
156 | 156 | } |
157 | 157 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | $formattedCategories = []; |
188 | 188 | $categories = $this->categoryFetcher->get(); |
189 | - foreach($categories as $category) { |
|
189 | + foreach ($categories as $category) { |
|
190 | 190 | $formattedCategories[] = [ |
191 | 191 | 'id' => $category['id'], |
192 | 192 | 'ident' => $category['id'], |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | |
218 | 218 | // add bundle information |
219 | 219 | $bundles = $this->bundleFetcher->getBundles(); |
220 | - foreach($bundles as $bundle) { |
|
221 | - foreach($bundle->getAppIdentifiers() as $identifier) { |
|
222 | - foreach($this->allApps as &$app) { |
|
223 | - if($app['id'] === $identifier) { |
|
220 | + foreach ($bundles as $bundle) { |
|
221 | + foreach ($bundle->getAppIdentifiers() as $identifier) { |
|
222 | + foreach ($this->allApps as &$app) { |
|
223 | + if ($app['id'] === $identifier) { |
|
224 | 224 | $app['bundleIds'][] = $bundle->getIdentifier(); |
225 | 225 | continue; |
226 | 226 | } |
@@ -247,15 +247,15 @@ discard block |
||
247 | 247 | $dependencyAnalyzer = new DependencyAnalyzer(new Platform($this->config), $this->l10n); |
248 | 248 | |
249 | 249 | // Extend existing app details |
250 | - $apps = array_map(function ($appData) use ($dependencyAnalyzer) { |
|
250 | + $apps = array_map(function($appData) use ($dependencyAnalyzer) { |
|
251 | 251 | if (isset($appData['appstoreData'])) { |
252 | 252 | $appstoreData = $appData['appstoreData']; |
253 | - $appData['screenshot'] = isset($appstoreData['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/' . base64_encode($appstoreData['screenshots'][0]['url']) : ''; |
|
253 | + $appData['screenshot'] = isset($appstoreData['screenshots'][0]['url']) ? 'https://usercontent.apps.nextcloud.com/'.base64_encode($appstoreData['screenshots'][0]['url']) : ''; |
|
254 | 254 | $appData['category'] = $appstoreData['categories']; |
255 | 255 | } |
256 | 256 | |
257 | 257 | $newVersion = $this->installer->isUpdateAvailable($appData['id']); |
258 | - if($newVersion) { |
|
258 | + if ($newVersion) { |
|
259 | 259 | $appData['update'] = $newVersion; |
260 | 260 | } |
261 | 261 | |
@@ -307,16 +307,16 @@ discard block |
||
307 | 307 | $versionParser = new VersionParser(); |
308 | 308 | $formattedApps = []; |
309 | 309 | $apps = $this->appFetcher->get(); |
310 | - foreach($apps as $app) { |
|
310 | + foreach ($apps as $app) { |
|
311 | 311 | // Skip all apps not in the requested category |
312 | 312 | if ($requestedCategory !== '') { |
313 | 313 | $isInCategory = false; |
314 | - foreach($app['categories'] as $category) { |
|
315 | - if($category === $requestedCategory) { |
|
314 | + foreach ($app['categories'] as $category) { |
|
315 | + if ($category === $requestedCategory) { |
|
316 | 316 | $isInCategory = true; |
317 | 317 | } |
318 | 318 | } |
319 | - if(!$isInCategory) { |
|
319 | + if (!$isInCategory) { |
|
320 | 320 | continue; |
321 | 321 | } |
322 | 322 | } |
@@ -326,28 +326,28 @@ discard block |
||
326 | 326 | } |
327 | 327 | $nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']); |
328 | 328 | $nextCloudVersionDependencies = []; |
329 | - if($nextCloudVersion->getMinimumVersion() !== '') { |
|
329 | + if ($nextCloudVersion->getMinimumVersion() !== '') { |
|
330 | 330 | $nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion(); |
331 | 331 | } |
332 | - if($nextCloudVersion->getMaximumVersion() !== '') { |
|
332 | + if ($nextCloudVersion->getMaximumVersion() !== '') { |
|
333 | 333 | $nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion(); |
334 | 334 | } |
335 | 335 | $phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']); |
336 | 336 | $existsLocally = \OC_App::getAppPath($app['id']) !== false; |
337 | 337 | $phpDependencies = []; |
338 | - if($phpVersion->getMinimumVersion() !== '') { |
|
338 | + if ($phpVersion->getMinimumVersion() !== '') { |
|
339 | 339 | $phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion(); |
340 | 340 | } |
341 | - if($phpVersion->getMaximumVersion() !== '') { |
|
341 | + if ($phpVersion->getMaximumVersion() !== '') { |
|
342 | 342 | $phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion(); |
343 | 343 | } |
344 | - if(isset($app['releases'][0]['minIntSize'])) { |
|
344 | + if (isset($app['releases'][0]['minIntSize'])) { |
|
345 | 345 | $phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize']; |
346 | 346 | } |
347 | 347 | $authors = ''; |
348 | - foreach($app['authors'] as $key => $author) { |
|
348 | + foreach ($app['authors'] as $key => $author) { |
|
349 | 349 | $authors .= $author['name']; |
350 | - if($key !== count($app['authors']) - 1) { |
|
350 | + if ($key !== count($app['authors']) - 1) { |
|
351 | 351 | $authors .= ', '; |
352 | 352 | } |
353 | 353 | } |
@@ -355,12 +355,12 @@ discard block |
||
355 | 355 | $currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2); |
356 | 356 | $enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no'); |
357 | 357 | $groups = null; |
358 | - if($enabledValue !== 'no' && $enabledValue !== 'yes') { |
|
358 | + if ($enabledValue !== 'no' && $enabledValue !== 'yes') { |
|
359 | 359 | $groups = $enabledValue; |
360 | 360 | } |
361 | 361 | |
362 | 362 | $currentVersion = ''; |
363 | - if($this->appManager->isInstalled($app['id'])) { |
|
363 | + if ($this->appManager->isInstalled($app['id'])) { |
|
364 | 364 | $currentVersion = $this->appManager->getAppVersion($app['id']); |
365 | 365 | } else { |
366 | 366 | $currentLanguage = $app['releases'][0]['version']; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $installer = \OC::$server->query(Installer::class); |
443 | 443 | $isDownloaded = $installer->isDownloaded($appId); |
444 | 444 | |
445 | - if(!$isDownloaded) { |
|
445 | + if (!$isDownloaded) { |
|
446 | 446 | $installer->downloadApp($appId); |
447 | 447 | } |
448 | 448 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | public function uninstallApp(string $appId): JSONResponse { |
516 | 516 | $appId = OC_App::cleanAppId($appId); |
517 | 517 | $result = $this->installer->removeApp($appId); |
518 | - if($result !== false) { |
|
518 | + if ($result !== false) { |
|
519 | 519 | $this->appManager->clearAppsCache(); |
520 | 520 | return new JSONResponse(['data' => ['appid' => $appId]]); |
521 | 521 | } |
@@ -545,8 +545,8 @@ discard block |
||
545 | 545 | } |
546 | 546 | |
547 | 547 | private function sortApps($a, $b) { |
548 | - $a = (string)$a['name']; |
|
549 | - $b = (string)$b['name']; |
|
548 | + $a = (string) $a['name']; |
|
549 | + $b = (string) $b['name']; |
|
550 | 550 | if ($a === $b) { |
551 | 551 | return 0; |
552 | 552 | } |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | private function entitiesToArray(array $entities) { |
149 | - return array_map(function (IEntity $entity) { |
|
150 | - $events = array_map(function (IEntityEvent $entityEvent) { |
|
149 | + return array_map(function(IEntity $entity) { |
|
150 | + $events = array_map(function(IEntityEvent $entityEvent) { |
|
151 | 151 | return [ |
152 | 152 | 'eventName' => $entityEvent->getEventName(), |
153 | 153 | 'displayName' => $entityEvent->getDisplayName() |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | private function operatorsToArray(array $operators) { |
167 | - $operators = array_filter($operators, function (IOperation $operator) { |
|
167 | + $operators = array_filter($operators, function(IOperation $operator) { |
|
168 | 168 | return $operator->isAvailableForScope($this->getScope()); |
169 | 169 | }); |
170 | 170 | |
171 | - return array_map(function (IOperation $operator) { |
|
171 | + return array_map(function(IOperation $operator) { |
|
172 | 172 | return [ |
173 | 173 | 'id' => get_class($operator), |
174 | 174 | 'icon' => $operator->getIcon(), |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | private function checksToArray(array $checks) { |
185 | - $checks = array_filter($checks, function (ICheck $check) { |
|
185 | + $checks = array_filter($checks, function(ICheck $check) { |
|
186 | 186 | return $check->isAvailableForScope($this->getScope()); |
187 | 187 | }); |
188 | 188 | |
189 | - return array_map(function (ICheck $check) { |
|
189 | + return array_map(function(ICheck $check) { |
|
190 | 190 | return [ |
191 | 191 | 'id' => get_class($check), |
192 | 192 | 'supportedEntities' => $check->supportedEntities(), |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $this->config = $config; |
78 | 78 | $this->userSession = $userSession; |
79 | 79 | $this->accessibilityProvider = $accessibilityProvider; |
80 | - $this->userId = $userSession->getUser()->getUID(); |
|
80 | + $this->userId = $userSession->getUser()->getUID(); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | if ($key === 'theme' || $key === 'font' || $key === 'highcontrast') { |
110 | 110 | |
111 | 111 | if ($value === false || $value === '') { |
112 | - throw new OCSBadRequestException('Invalid value: ' . $value); |
|
112 | + throw new OCSBadRequestException('Invalid value: '.$value); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $themes = $this->accessibilityProvider->getThemes(); |
116 | 116 | $highcontrast = [$this->accessibilityProvider->getHighContrast()]; |
117 | 117 | $fonts = $this->accessibilityProvider->getFonts(); |
118 | 118 | |
119 | - $availableOptions = array_map(function ($option) { |
|
119 | + $availableOptions = array_map(function($option) { |
|
120 | 120 | return $option['id']; |
121 | 121 | }, array_merge($themes, $highcontrast, $fonts)); |
122 | 122 | |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | return new DataResponse(); |
126 | 126 | } |
127 | 127 | |
128 | - throw new OCSBadRequestException('Invalid value: ' . $value); |
|
128 | + throw new OCSBadRequestException('Invalid value: '.$value); |
|
129 | 129 | } |
130 | 130 | |
131 | - throw new OCSBadRequestException('Invalid key: ' . $key); |
|
131 | + throw new OCSBadRequestException('Invalid key: '.$key); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return new DataResponse(); |
155 | 155 | } |
156 | 156 | |
157 | - throw new OCSBadRequestException('Invalid key: ' . $key); |
|
157 | + throw new OCSBadRequestException('Invalid key: '.$key); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } |