@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | protected $exactIdMatches = []; |
48 | 48 | |
49 | 49 | public function addResultSet($type, array $matches, array $exactMatches = null) { |
50 | - if(!isset($this->result[$type])) { |
|
50 | + if (!isset($this->result[$type])) { |
|
51 | 51 | throw new \InvalidArgumentException('Invalid type provided'); |
52 | 52 | } |
53 | 53 | |
54 | 54 | $this->result[$type] = array_merge($this->result[$type], $matches); |
55 | - if(is_array($exactMatches)) { |
|
55 | + if (is_array($exactMatches)) { |
|
56 | 56 | $this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches); |
57 | 57 | } |
58 | 58 | } |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | public function hasResult($type, $collaboratorId) { |
69 | - if(!isset($this->result[$type])) { |
|
69 | + if (!isset($this->result[$type])) { |
|
70 | 70 | throw new \InvalidArgumentException('Invalid type provided'); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $resultArrays = [$this->result['exact'][$type], $this->result[$type]]; |
74 | - foreach($resultArrays as $resultArray) { |
|
74 | + foreach ($resultArrays as $resultArray) { |
|
75 | 75 | if ($resultArray['value']['shareWith'] === $collaboratorId) { |
76 | 76 | return true; |
77 | 77 | } |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | public function unsetResult($type) { |
88 | - if(!isset($this->result[$type])) { |
|
88 | + if (!isset($this->result[$type])) { |
|
89 | 89 | throw new \InvalidArgumentException('Invalid type provided'); |
90 | 90 | } |
91 | 91 | |
92 | 92 | $this->result[$type] = []; |
93 | - if(isset($this->$result['exact'][$type])) { |
|
93 | + if (isset($this->$result['exact'][$type])) { |
|
94 | 94 | $this->result['exact'][$type] = []; |
95 | 95 | } |
96 | 96 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function search($search, $limit, $offset, ISearchResult $searchResult) { |
33 | 33 | $result = ['wide' => [], 'exact' => []]; |
34 | 34 | |
35 | - if(\OC_App::isEnabled('circles')) { |
|
35 | + if (\OC_App::isEnabled('circles')) { |
|
36 | 36 | $circles = Sharees::search($search); |
37 | 37 | if (array_key_exists('circles', $circles['exact'])) { |
38 | 38 | $result['exact'] = $circles['exact']['circles']; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $searchResult->hasExactIdMatch('remotes'); |
78 | 78 | } |
79 | 79 | $result['exact'][] = [ |
80 | - 'label' => $contact['FN'] . " ($cloudId)", |
|
80 | + 'label' => $contact['FN']." ($cloudId)", |
|
81 | 81 | 'value' => [ |
82 | 82 | 'shareType' => Share::SHARE_TYPE_REMOTE, |
83 | 83 | 'shareWith' => $cloudId, |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ]; |
87 | 87 | } else { |
88 | 88 | $result['wide'][] = [ |
89 | - 'label' => $contact['FN'] . " ($cloudId)", |
|
89 | + 'label' => $contact['FN']." ($cloudId)", |
|
90 | 90 | 'value' => [ |
91 | 91 | 'shareType' => Share::SHARE_TYPE_REMOTE, |
92 | 92 | 'shareWith' => $cloudId, |
@@ -56,17 +56,17 @@ |
||
56 | 56 | $result = ['wide' => [], 'exact' => []]; |
57 | 57 | |
58 | 58 | $groups = $this->groupManager->search($search, $limit, $offset); |
59 | - $groupIds = array_map(function (IGroup $group) { return $group->getGID(); }, $groups); |
|
59 | + $groupIds = array_map(function(IGroup $group) { return $group->getGID(); }, $groups); |
|
60 | 60 | |
61 | 61 | if (!$this->shareeEnumeration || sizeof($groups) < $limit) { |
62 | 62 | $hasMoreResults = true; |
63 | 63 | } |
64 | 64 | |
65 | - $userGroups = []; |
|
65 | + $userGroups = []; |
|
66 | 66 | if (!empty($groups) && $this->shareWithGroupOnly) { |
67 | 67 | // Intersect all the groups that match with the groups this user is a member of |
68 | 68 | $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); |
69 | - $userGroups = array_map(function (IGroup $group) { return $group->getGID(); }, $userGroups); |
|
69 | + $userGroups = array_map(function(IGroup $group) { return $group->getGID(); }, $userGroups); |
|
70 | 70 | $groupIds = array_intersect($groupIds, $userGroups); |
71 | 71 | } |
72 | 72 |
@@ -54,7 +54,7 @@ |
||
54 | 54 | try { |
55 | 55 | $client = $this->clientService->newClient(); |
56 | 56 | $response = $client->get( |
57 | - $lookupServerUrl . '/users?search=' . urlencode($search), |
|
57 | + $lookupServerUrl.'/users?search='.urlencode($search), |
|
58 | 58 | [ |
59 | 59 | 'timeout' => 10, |
60 | 60 | 'connect_timeout' => 3, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | if (!$searchResult->hasResult('users', $cloud->getUser())) { |
85 | 85 | $singleResult = [[ |
86 | - 'label' => $contact['FN'] . " ($emailAddress)", |
|
86 | + 'label' => $contact['FN']." ($emailAddress)", |
|
87 | 87 | 'value' => [ |
88 | 88 | 'shareType' => Share::SHARE_TYPE_USER, |
89 | 89 | 'shareWith' => $cloud->getUser(), |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if (!$searchResult->hasResult('users', $cloud->getUser())) { |
106 | 106 | $singleResult = [[ |
107 | - 'label' => $contact['FN'] . " ($emailAddress)", |
|
107 | + 'label' => $contact['FN']." ($emailAddress)", |
|
108 | 108 | 'value' => [ |
109 | 109 | 'shareType' => Share::SHARE_TYPE_USER, |
110 | 110 | 'shareWith' => $cloud->getUser(), |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $searchResult->markExactIdMatch('emails'); |
123 | 123 | } |
124 | 124 | $result['exact'][] = [ |
125 | - 'label' => $contact['FN'] . " ($emailAddress)", |
|
125 | + 'label' => $contact['FN']." ($emailAddress)", |
|
126 | 126 | 'value' => [ |
127 | 127 | 'shareType' => Share::SHARE_TYPE_EMAIL, |
128 | 128 | 'shareWith' => $emailAddress, |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | ]; |
131 | 131 | } else { |
132 | 132 | $result['wide'][] = [ |
133 | - 'label' => $contact['FN'] . " ($emailAddress)", |
|
133 | + 'label' => $contact['FN']." ($emailAddress)", |
|
134 | 134 | 'value' => [ |
135 | 135 | 'shareType' => Share::SHARE_TYPE_EMAIL, |
136 | 136 | 'shareWith' => $emailAddress, |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $searchResult = $this->c->resolve(SearchResult::class); |
53 | 53 | |
54 | 54 | foreach ($shareTypes as $type) { |
55 | - if(!isset($pluginList[$type])) { |
|
55 | + if (!isset($pluginList[$type])) { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | 58 | /** @var ISearchPlugin $searchPlugin */ |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // if we have a exact match, either for the federated cloud id or for the |
72 | 72 | // email address we only return the exact match. It is highly unlikely |
73 | 73 | // that the exact same email address and federated cloud id exists |
74 | - if($searchResult->hasExactIdMatch('emails') && !$searchResult->hasExactIdMatch('remotes')) { |
|
74 | + if ($searchResult->hasExactIdMatch('emails') && !$searchResult->hasExactIdMatch('remotes')) { |
|
75 | 75 | $searchResult->unsetResult('remotes'); |
76 | 76 | } elseif (!$searchResult->hasExactIdMatch('emails') && $searchResult->hasExactIdMatch('remotes')) { |
77 | 77 | $searchResult->unsetResult('emails'); |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | public function search($search = '', $itemType = null, $page = 1, $perPage = 200, $shareType = null, $lookup = true) { |
140 | 140 | |
141 | 141 | // only search for string larger than a given threshold |
142 | - $threshold = (int)$this->config->getSystemValue('sharing.minSearchStringLength', 0); |
|
142 | + $threshold = (int) $this->config->getSystemValue('sharing.minSearchStringLength', 0); |
|
143 | 143 | if (strlen($search) < $threshold) { |
144 | 144 | return new DataResponse($this->result); |
145 | 145 | } |
146 | 146 | |
147 | 147 | // never return more than the max. number of results configured in the config.php |
148 | - $maxResults = (int)$this->config->getSystemValue('sharing.maxAutocompleteResults', 0); |
|
148 | + $maxResults = (int) $this->config->getSystemValue('sharing.maxAutocompleteResults', 0); |
|
149 | 149 | if ($maxResults > 0) { |
150 | 150 | $perPage = min($perPage, $maxResults); |
151 | 151 | } |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | */ |
238 | 238 | protected function getPaginationLink($page, array $params) { |
239 | 239 | if ($this->isV2()) { |
240 | - $url = $this->urlGenerator->getAbsoluteURL('/ocs/v2.php/apps/files_sharing/api/v1/sharees') . '?'; |
|
240 | + $url = $this->urlGenerator->getAbsoluteURL('/ocs/v2.php/apps/files_sharing/api/v1/sharees').'?'; |
|
241 | 241 | } else { |
242 | - $url = $this->urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/sharees') . '?'; |
|
242 | + $url = $this->urlGenerator->getAbsoluteURL('/ocs/v1.php/apps/files_sharing/api/v1/sharees').'?'; |
|
243 | 243 | } |
244 | 244 | $params['page'] = $page + 1; |
245 | - $link = '<' . $url . http_build_query($params) . '>; rel="next"'; |
|
245 | + $link = '<'.$url.http_build_query($params).'>; rel="next"'; |
|
246 | 246 | |
247 | 247 | return $link; |
248 | 248 | } |