@@ -63,7 +63,7 @@ |
||
63 | 63 | public function findAll(?int $limit = null, ?int $offset = null): DataResponse { |
64 | 64 | $allStatuses = $this->service->findAll($limit, $offset); |
65 | 65 | |
66 | - return new DataResponse(array_map(function ($userStatus) { |
|
66 | + return new DataResponse(array_map(function($userStatus) { |
|
67 | 67 | return $this->formatStatus($userStatus); |
68 | 68 | }, $allStatuses)); |
69 | 69 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return SearchResult::complete($this->getName(), []); |
94 | 94 | } |
95 | 95 | |
96 | - $principalUri = 'principals/users/' . $user->getUID(); |
|
96 | + $principalUri = 'principals/users/'.$user->getUID(); |
|
97 | 97 | $calendarsById = $this->getSortedCalendars($principalUri); |
98 | 98 | $subscriptionsById = $this->getSortedSubscriptions($principalUri); |
99 | 99 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | 'offset' => $query->getCursor(), |
109 | 109 | ] |
110 | 110 | ); |
111 | - $formattedResults = \array_map(function (array $taskRow) use ($calendarsById, $subscriptionsById):SearchResultEntry { |
|
111 | + $formattedResults = \array_map(function(array $taskRow) use ($calendarsById, $subscriptionsById):SearchResultEntry { |
|
112 | 112 | $component = $this->getPrimaryComponent($taskRow['calendardata'], self::$componentType); |
113 | - $title = (string)($component->SUMMARY ?? $this->l10n->t('Untitled task')); |
|
113 | + $title = (string) ($component->SUMMARY ?? $this->l10n->t('Untitled task')); |
|
114 | 114 | $subline = $this->generateSubline($component); |
115 | 115 | |
116 | 116 | if ($taskRow['calendartype'] === CalDavBackend::CALENDAR_TYPE_CALENDAR) { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'privilege' => '{DAV:}read', |
111 | 111 | 'principal' => $this->getOwner(), |
112 | 112 | 'protected' => true, |
113 | - ],[ |
|
113 | + ], [ |
|
114 | 114 | 'privilege' => '{DAV:}write', |
115 | 115 | 'principal' => $this->getOwner(), |
116 | 116 | 'protected' => true, |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | $acl = $this->carddavBackend->applyShareAcl($this->getResourceId(), $acl); |
148 | 148 | $allowedPrincipals = [$this->getOwner(), parent::getOwner(), 'principals/system/system']; |
149 | - return array_filter($acl, function ($rule) use ($allowedPrincipals) { |
|
149 | + return array_filter($acl, function($rule) use ($allowedPrincipals) { |
|
150 | 150 | return \in_array($rule['principal'], $allowedPrincipals, true); |
151 | 151 | }); |
152 | 152 | } |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | |
181 | 181 | public function delete() { |
182 | 182 | if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { |
183 | - $principal = 'principal:' . parent::getOwner(); |
|
183 | + $principal = 'principal:'.parent::getOwner(); |
|
184 | 184 | $shares = $this->carddavBackend->getShares($this->getResourceId()); |
185 | - $shares = array_filter($shares, function ($share) use ($principal) { |
|
185 | + $shares = array_filter($shares, function($share) use ($principal) { |
|
186 | 186 | return $share['href'] === $principal; |
187 | 187 | }); |
188 | 188 | if (empty($shares)) { |
@@ -103,7 +103,7 @@ |
||
103 | 103 | } |
104 | 104 | |
105 | 105 | // $calendarHomePath will look like: calendars/username |
106 | - $calendarHomePath = $pathParts[0] . '/' . $pathParts[1]; |
|
106 | + $calendarHomePath = $pathParts[0].'/'.$pathParts[1]; |
|
107 | 107 | try { |
108 | 108 | $calendarHome = $this->server->tree->getNodeForPath($calendarHomePath); |
109 | 109 | if (!($calendarHome instanceof CalendarHome)) { |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | */ |
597 | 597 | private function getVEventByRecurrenceId(VObject\Component\VCalendar $vcalendar, |
598 | 598 | int $recurrenceId, |
599 | - bool $isRecurrenceException):?VEvent { |
|
599 | + bool $isRecurrenceException): ?VEvent { |
|
600 | 600 | $vevents = $this->getAllVEventsFromVCalendar($vcalendar); |
601 | 601 | if (count($vevents) === 0) { |
602 | 602 | return null; |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * @param string $calendarData |
675 | 675 | * @return VObject\Component\VCalendar|null |
676 | 676 | */ |
677 | - private function parseCalendarData(string $calendarData):?VObject\Component\VCalendar { |
|
677 | + private function parseCalendarData(string $calendarData): ?VObject\Component\VCalendar { |
|
678 | 678 | try { |
679 | 679 | return VObject\Reader::read($calendarData, |
680 | 680 | VObject\Reader::OPTION_FORGIVING); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @param string $principalUri |
688 | 688 | * @return IUser|null |
689 | 689 | */ |
690 | - private function getUserFromPrincipalURI(string $principalUri):?IUser { |
|
690 | + private function getUserFromPrincipalURI(string $principalUri): ?IUser { |
|
691 | 691 | if (!$principalUri) { |
692 | 692 | return null; |
693 | 693 | } |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * @return VObject\Component\VEvent[] |
728 | 728 | */ |
729 | 729 | private function getRecurrenceExceptionFromListOfVEvents(array $vevents):array { |
730 | - return array_values(array_filter($vevents, function (VEvent $vevent) { |
|
730 | + return array_values(array_filter($vevents, function(VEvent $vevent) { |
|
731 | 731 | return $vevent->{'RECURRENCE-ID'} !== null; |
732 | 732 | })); |
733 | 733 | } |
@@ -736,8 +736,8 @@ discard block |
||
736 | 736 | * @param array $vevents |
737 | 737 | * @return VEvent|null |
738 | 738 | */ |
739 | - private function getMasterItemFromListOfVEvents(array $vevents):?VEvent { |
|
740 | - $elements = array_values(array_filter($vevents, function (VEvent $vevent) { |
|
739 | + private function getMasterItemFromListOfVEvents(array $vevents): ?VEvent { |
|
740 | + $elements = array_values(array_filter($vevents, function(VEvent $vevent) { |
|
741 | 741 | return $vevent->{'RECURRENCE-ID'} === null; |
742 | 742 | })); |
743 | 743 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function getGroups(string $search = '', int $limit = null, int $offset = 0): DataResponse { |
90 | 90 | $groups = $this->groupManager->search($search, $limit, $offset); |
91 | - $groups = array_map(function ($group) { |
|
91 | + $groups = array_map(function($group) { |
|
92 | 92 | /** @var IGroup $group */ |
93 | 93 | return $group->getGID(); |
94 | 94 | }, $groups); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function getGroupsDetails(string $search = '', int $limit = null, int $offset = 0): DataResponse { |
110 | 110 | $groups = $this->groupManager->search($search, $limit, $offset); |
111 | - $groups = array_map(function ($group) { |
|
111 | + $groups = array_map(function($group) { |
|
112 | 112 | /** @var IGroup $group */ |
113 | 113 | return [ |
114 | 114 | 'id' => $group->getGID(), |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if ($this->groupManager->isAdmin($user->getUID()) |
164 | 164 | || $isSubadminOfGroup) { |
165 | 165 | $users = $this->groupManager->get($groupId)->getUsers(); |
166 | - $users = array_map(function ($user) { |
|
166 | + $users = array_map(function($user) { |
|
167 | 167 | /** @var IUser $user */ |
168 | 168 | return $user->getUID(); |
169 | 169 | }, $users); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | foreach ($users as $user) { |
208 | 208 | try { |
209 | 209 | /** @var IUser $user */ |
210 | - $userId = (string)$user->getUID(); |
|
210 | + $userId = (string) $user->getUID(); |
|
211 | 211 | $userData = $this->getUserData($userId); |
212 | 212 | // Do not insert empty entry |
213 | 213 | if (!empty($userData)) { |
@@ -36,8 +36,8 @@ |
||
36 | 36 | |
37 | 37 | protected function run($argument) { |
38 | 38 | $config = \OC::$server->getConfig(); |
39 | - $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/flow.log'; |
|
40 | - $this->filePath = trim((string)$config->getAppValue(Application::APP_ID, 'logfile', $default)); |
|
39 | + $default = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/flow.log'; |
|
40 | + $this->filePath = trim((string) $config->getAppValue(Application::APP_ID, 'logfile', $default)); |
|
41 | 41 | |
42 | 42 | if ($this->filePath === '') { |
43 | 43 | // disabled, nothing to do |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function discover(string $remote, string $service, bool $skipCache = false): array { |
70 | 70 | // Check the cache first |
71 | 71 | if ($skipCache === false) { |
72 | - $cacheData = $this->cache->get($remote . '#' . $service); |
|
72 | + $cacheData = $this->cache->get($remote.'#'.$service); |
|
73 | 73 | if ($cacheData) { |
74 | 74 | $data = json_decode($cacheData, true); |
75 | 75 | if (\is_array($data)) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | // query the remote server for available services |
84 | 84 | try { |
85 | - $response = $this->client->get($remote . '/ocs-provider/', [ |
|
85 | + $response = $this->client->get($remote.'/ocs-provider/', [ |
|
86 | 86 | 'timeout' => 10, |
87 | 87 | 'connect_timeout' => 10, |
88 | 88 | ]); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | // Write into cache |
100 | - $this->cache->set($remote . '#' . $service, json_encode($discoveredServices), 60 * 60 * 24); |
|
100 | + $this->cache->set($remote.'#'.$service, json_encode($discoveredServices), 60 * 60 * 24); |
|
101 | 101 | return $discoveredServices; |
102 | 102 | } |
103 | 103 | |
@@ -130,6 +130,6 @@ discard block |
||
130 | 130 | * @return bool |
131 | 131 | */ |
132 | 132 | protected function isSafeUrl(string $url): bool { |
133 | - return (bool)preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); |
|
133 | + return (bool) preg_match('/^[\/\.\-A-Za-z0-9]+$/', $url); |
|
134 | 134 | } |
135 | 135 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | private function getCutoff(int $expire): \DateInterval { |
94 | 94 | $d1 = new \DateTime(); |
95 | 95 | $d2 = clone $d1; |
96 | - $d2->sub(new \DateInterval('PT' . $expire . 'S')); |
|
96 | + $d2->sub(new \DateInterval('PT'.$expire.'S')); |
|
97 | 97 | return $d2->diff($d1); |
98 | 98 | } |
99 | 99 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $values = [ |
129 | 129 | 'action' => $action, |
130 | 130 | 'occurred' => $this->timeFactory->getTime(), |
131 | - 'ip' => (string)$ipAddress, |
|
131 | + 'ip' => (string) $ipAddress, |
|
132 | 132 | 'subnet' => $ipAddress->getSubnet(), |
133 | 133 | 'metadata' => json_encode($metadata), |
134 | 134 | ]; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | $keys = $this->config->getAppKeys('bruteForce'); |
167 | - $keys = array_filter($keys, function ($key) { |
|
167 | + $keys = array_filter($keys, function($key) { |
|
168 | 168 | return 0 === strpos($key, 'whitelist_'); |
169 | 169 | }); |
170 | 170 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $cx = explode('/', $cidr); |
185 | 185 | $addr = $cx[0]; |
186 | - $mask = (int)$cx[1]; |
|
186 | + $mask = (int) $cx[1]; |
|
187 | 187 | |
188 | 188 | // Do not compare ipv4 to ipv6 |
189 | 189 | if (($type === 4 && !filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) || |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | |
196 | 196 | $valid = true; |
197 | 197 | for ($i = 0; $i < $mask; $i++) { |
198 | - $part = ord($addr[(int)($i / 8)]); |
|
199 | - $orig = ord($ip[(int)($i / 8)]); |
|
198 | + $part = ord($addr[(int) ($i / 8)]); |
|
199 | + $orig = ord($ip[(int) ($i / 8)]); |
|
200 | 200 | |
201 | 201 | $bitmask = 1 << (7 - ($i % 8)); |
202 | 202 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | $ipAddress = new IpAddress($ip); |
234 | - if ($this->isIPWhitelisted((string)$ipAddress)) { |
|
234 | + if ($this->isIPWhitelisted((string) $ipAddress)) { |
|
235 | 235 | return 0; |
236 | 236 | } |
237 | 237 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function resetDelay(string $ip, string $action, array $metadata): void { |
291 | 291 | $ipAddress = new IpAddress($ip); |
292 | - if ($this->isIPWhitelisted((string)$ipAddress)) { |
|
292 | + if ($this->isIPWhitelisted((string) $ipAddress)) { |
|
293 | 293 | return; |
294 | 294 | } |
295 | 295 |