@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | * @param array $headers additional key value based headers |
47 | 47 | * @since 8.1.0 |
48 | 48 | */ |
49 | - public function __construct($data='', $statusCode=Http::STATUS_OK, |
|
50 | - $headers=[]) { |
|
49 | + public function __construct($data = '', $statusCode = Http::STATUS_OK, |
|
50 | + $headers = []) { |
|
51 | 51 | $this->data = $data; |
52 | 52 | $this->setStatus($statusCode); |
53 | 53 | $this->setHeaders(array_merge($this->getHeaders(), $headers)); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return DataDisplayResponse Reference to this object |
71 | 71 | * @since 8.1.0 |
72 | 72 | */ |
73 | - public function setData($data){ |
|
73 | + public function setData($data) { |
|
74 | 74 | $this->data = $data; |
75 | 75 | |
76 | 76 | return $this; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return string the data |
83 | 83 | * @since 8.1.0 |
84 | 84 | */ |
85 | - public function getData(){ |
|
85 | + public function getData() { |
|
86 | 86 | return $this->data; |
87 | 87 | } |
88 | 88 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param string $source either a local file or string data |
50 | 50 | * @return bool |
51 | 51 | */ |
52 | - public abstract function addFile($path, $source=''); |
|
52 | + public abstract function addFile($path, $source = ''); |
|
53 | 53 | /** |
54 | 54 | * rename a file or folder in the archive |
55 | 55 | * @param string $source |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function addRecursive($path, $source) { |
128 | 128 | $dh = opendir($source); |
129 | - if(is_resource($dh)) { |
|
129 | + if (is_resource($dh)) { |
|
130 | 130 | $this->addFolder($path); |
131 | 131 | while (($file = readdir($dh)) !== false) { |
132 | - if($file === '.' || $file === '..') { |
|
132 | + if ($file === '.' || $file === '..') { |
|
133 | 133 | continue; |
134 | 134 | } |
135 | - if(is_dir($source.'/'.$file)) { |
|
135 | + if (is_dir($source.'/'.$file)) { |
|
136 | 136 | $this->addRecursive($path.'/'.$file, $source.'/'.$file); |
137 | - }else{ |
|
137 | + } else { |
|
138 | 138 | $this->addFile($path.'/'.$file, $source.'/'.$file); |
139 | 139 | } |
140 | 140 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | ->orderBy('id'); |
288 | 288 | |
289 | 289 | $cursor = $qb->execute(); |
290 | - while($data = $cursor->fetch()) { |
|
290 | + while ($data = $cursor->fetch()) { |
|
291 | 291 | $children[] = $this->createShare($data); |
292 | 292 | } |
293 | 293 | $cursor->closeCursor(); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $user = $this->userManager->get($recipient); |
333 | 333 | |
334 | 334 | if (is_null($group)) { |
335 | - throw new ProviderException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
335 | + throw new ProviderException('Group "'.$share->getSharedWith().'" does not exist'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | if (!$group->inGroup($user)) { |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | ); |
493 | 493 | } |
494 | 494 | |
495 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
495 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
496 | 496 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
497 | 497 | |
498 | 498 | $qb->orderBy('id'); |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | |
549 | 549 | $cursor = $qb->execute(); |
550 | 550 | $shares = []; |
551 | - while($data = $cursor->fetch()) { |
|
551 | + while ($data = $cursor->fetch()) { |
|
552 | 552 | $shares[] = $this->createShare($data); |
553 | 553 | } |
554 | 554 | $cursor->closeCursor(); |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | ->execute(); |
628 | 628 | |
629 | 629 | $shares = []; |
630 | - while($data = $cursor->fetch()) { |
|
630 | + while ($data = $cursor->fetch()) { |
|
631 | 631 | $shares[] = $this->createShare($data); |
632 | 632 | } |
633 | 633 | $cursor->closeCursor(); |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | |
699 | 699 | $cursor = $qb->execute(); |
700 | 700 | |
701 | - while($data = $cursor->fetch()) { |
|
701 | + while ($data = $cursor->fetch()) { |
|
702 | 702 | if ($this->isAccessibleResult($data)) { |
703 | 703 | $shares[] = $this->createShare($data); |
704 | 704 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | $shares2 = []; |
714 | 714 | |
715 | 715 | $start = 0; |
716 | - while(true) { |
|
716 | + while (true) { |
|
717 | 717 | $groups = array_slice($allGroups, $start, 100); |
718 | 718 | $start += 100; |
719 | 719 | |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | )); |
759 | 759 | |
760 | 760 | $cursor = $qb->execute(); |
761 | - while($data = $cursor->fetch()) { |
|
761 | + while ($data = $cursor->fetch()) { |
|
762 | 762 | if ($offset > 0) { |
763 | 763 | $offset--; |
764 | 764 | continue; |
@@ -827,14 +827,14 @@ discard block |
||
827 | 827 | */ |
828 | 828 | private function createShare($data) { |
829 | 829 | $share = new Share($this->rootFolder, $this->userManager); |
830 | - $share->setId((int)$data['id']) |
|
831 | - ->setShareType((int)$data['share_type']) |
|
832 | - ->setPermissions((int)$data['permissions']) |
|
830 | + $share->setId((int) $data['id']) |
|
831 | + ->setShareType((int) $data['share_type']) |
|
832 | + ->setPermissions((int) $data['permissions']) |
|
833 | 833 | ->setTarget($data['file_target']) |
834 | - ->setMailSend((bool)$data['mail_send']); |
|
834 | + ->setMailSend((bool) $data['mail_send']); |
|
835 | 835 | |
836 | 836 | $shareTime = new \DateTime(); |
837 | - $shareTime->setTimestamp((int)$data['stime']); |
|
837 | + $shareTime->setTimestamp((int) $data['stime']); |
|
838 | 838 | $share->setShareTime($shareTime); |
839 | 839 | |
840 | 840 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | $share->setSharedBy($data['uid_initiator']); |
850 | 850 | $share->setShareOwner($data['uid_owner']); |
851 | 851 | |
852 | - $share->setNodeId((int)$data['file_source']); |
|
852 | + $share->setNodeId((int) $data['file_source']); |
|
853 | 853 | $share->setNodeType($data['item_type']); |
854 | 854 | |
855 | 855 | if ($data['expiration'] !== null) { |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | $result = []; |
880 | 880 | |
881 | 881 | $start = 0; |
882 | - while(true) { |
|
882 | + while (true) { |
|
883 | 883 | /** @var Share[] $shareSlice */ |
884 | 884 | $shareSlice = array_slice($shares, $start, 100); |
885 | 885 | $start += 100; |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | $shareMap = []; |
895 | 895 | |
896 | 896 | foreach ($shareSlice as $share) { |
897 | - $ids[] = (int)$share->getId(); |
|
897 | + $ids[] = (int) $share->getId(); |
|
898 | 898 | $shareMap[$share->getId()] = $share; |
899 | 899 | } |
900 | 900 | |
@@ -911,8 +911,8 @@ discard block |
||
911 | 911 | |
912 | 912 | $stmt = $query->execute(); |
913 | 913 | |
914 | - while($data = $stmt->fetch()) { |
|
915 | - $shareMap[$data['parent']]->setPermissions((int)$data['permissions']); |
|
914 | + while ($data = $stmt->fetch()) { |
|
915 | + $shareMap[$data['parent']]->setPermissions((int) $data['permissions']); |
|
916 | 916 | $shareMap[$data['parent']]->setTarget($data['file_target']); |
917 | 917 | } |
918 | 918 | |
@@ -1009,8 +1009,8 @@ discard block |
||
1009 | 1009 | |
1010 | 1010 | $cursor = $qb->execute(); |
1011 | 1011 | $ids = []; |
1012 | - while($row = $cursor->fetch()) { |
|
1013 | - $ids[] = (int)$row['id']; |
|
1012 | + while ($row = $cursor->fetch()) { |
|
1013 | + $ids[] = (int) $row['id']; |
|
1014 | 1014 | } |
1015 | 1015 | $cursor->closeCursor(); |
1016 | 1016 | |
@@ -1052,8 +1052,8 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | $cursor = $qb->execute(); |
1054 | 1054 | $ids = []; |
1055 | - while($row = $cursor->fetch()) { |
|
1056 | - $ids[] = (int)$row['id']; |
|
1055 | + while ($row = $cursor->fetch()) { |
|
1056 | + $ids[] = (int) $row['id']; |
|
1057 | 1057 | } |
1058 | 1058 | $cursor->closeCursor(); |
1059 | 1059 | |
@@ -1107,8 +1107,8 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | $users = []; |
1109 | 1109 | $link = false; |
1110 | - while($row = $cursor->fetch()) { |
|
1111 | - $type = (int)$row['share_type']; |
|
1110 | + while ($row = $cursor->fetch()) { |
|
1111 | + $type = (int) $row['share_type']; |
|
1112 | 1112 | if ($type === \OCP\Share::SHARE_TYPE_USER) { |
1113 | 1113 | $uid = $row['share_with']; |
1114 | 1114 | $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return true; |
82 | 82 | } |
83 | 83 | // Reject misformed domains in any case |
84 | - if (strpos($domain,'-') === 0 || strpos($domain,'..') !== false) { |
|
84 | + if (strpos($domain, '-') === 0 || strpos($domain, '..') !== false) { |
|
85 | 85 | return false; |
86 | 86 | } |
87 | 87 | // Match, allowing for * wildcards |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if (gettype($trusted) !== 'string') { |
90 | 90 | break; |
91 | 91 | } |
92 | - $regex = '/^' . implode('[-\.a-zA-Z0-9]*', array_map(function($v) { return preg_quote($v, '/'); }, explode('*', $trusted))) . '$/'; |
|
92 | + $regex = '/^'.implode('[-\.a-zA-Z0-9]*', array_map(function($v) { return preg_quote($v, '/'); }, explode('*', $trusted))).'$/'; |
|
93 | 93 | if (preg_match($regex, $domain) || preg_match($regex, $domainWithPort)) { |
94 | 94 | return true; |
95 | 95 | } |
@@ -47,28 +47,28 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | public function get($key) { |
50 | - return xcache_get($this->getNameSpace() . $key); |
|
50 | + return xcache_get($this->getNameSpace().$key); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | public function set($key, $value, $ttl = 0) { |
54 | 54 | if ($ttl > 0) { |
55 | - return xcache_set($this->getNameSpace() . $key, $value, $ttl); |
|
55 | + return xcache_set($this->getNameSpace().$key, $value, $ttl); |
|
56 | 56 | } else { |
57 | - return xcache_set($this->getNameSpace() . $key, $value); |
|
57 | + return xcache_set($this->getNameSpace().$key, $value); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | 61 | public function hasKey($key) { |
62 | - return xcache_isset($this->getNameSpace() . $key); |
|
62 | + return xcache_isset($this->getNameSpace().$key); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function remove($key) { |
66 | - return xcache_unset($this->getNameSpace() . $key); |
|
66 | + return xcache_unset($this->getNameSpace().$key); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function clear($prefix = '') { |
70 | 70 | if (function_exists('xcache_unset_by_prefix')) { |
71 | - return xcache_unset_by_prefix($this->getNameSpace() . $prefix); |
|
71 | + return xcache_unset_by_prefix($this->getNameSpace().$prefix); |
|
72 | 72 | } else { |
73 | 73 | // Since we can not clear by prefix, we just clear the whole cache. |
74 | 74 | xcache_clear_cache(\XC_TYPE_VAR, 0); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return int | bool |
101 | 101 | */ |
102 | 102 | public function inc($key, $step = 1) { |
103 | - return xcache_inc($this->getPrefix() . $key, $step); |
|
103 | + return xcache_inc($this->getPrefix().$key, $step); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return int | bool |
112 | 112 | */ |
113 | 113 | public function dec($key, $step = 1) { |
114 | - return xcache_dec($this->getPrefix() . $key, $step); |
|
114 | + return xcache_dec($this->getPrefix().$key, $step); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | static public function isAvailable() { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | public function get($key) { |
100 | - $result = self::$cache->get($this->getNameSpace() . $key); |
|
100 | + $result = self::$cache->get($this->getNameSpace().$key); |
|
101 | 101 | if ($result === false and self::$cache->getResultCode() == \Memcached::RES_NOTFOUND) { |
102 | 102 | return null; |
103 | 103 | } else { |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | |
108 | 108 | public function set($key, $value, $ttl = 0) { |
109 | 109 | if ($ttl > 0) { |
110 | - $result = self::$cache->set($this->getNameSpace() . $key, $value, $ttl); |
|
110 | + $result = self::$cache->set($this->getNameSpace().$key, $value, $ttl); |
|
111 | 111 | } else { |
112 | - $result = self::$cache->set($this->getNameSpace() . $key, $value); |
|
112 | + $result = self::$cache->set($this->getNameSpace().$key, $value); |
|
113 | 113 | } |
114 | 114 | if ($result !== true) { |
115 | 115 | $this->verifyReturnCode(); |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | public function hasKey($key) { |
121 | - self::$cache->get($this->getNameSpace() . $key); |
|
121 | + self::$cache->get($this->getNameSpace().$key); |
|
122 | 122 | return self::$cache->getResultCode() === \Memcached::RES_SUCCESS; |
123 | 123 | } |
124 | 124 | |
125 | 125 | public function remove($key) { |
126 | - $result= self::$cache->delete($this->getNameSpace() . $key); |
|
126 | + $result = self::$cache->delete($this->getNameSpace().$key); |
|
127 | 127 | if (self::$cache->getResultCode() !== \Memcached::RES_NOTFOUND) { |
128 | 128 | $this->verifyReturnCode(); |
129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | public function clear($prefix = '') { |
134 | - $prefix = $this->getNameSpace() . $prefix; |
|
134 | + $prefix = $this->getNameSpace().$prefix; |
|
135 | 135 | $allKeys = self::$cache->getAllKeys(); |
136 | 136 | if ($allKeys === false) { |
137 | 137 | // newer Memcached doesn't like getAllKeys(), flush everything |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @throws \Exception |
166 | 166 | */ |
167 | 167 | public function add($key, $value, $ttl = 0) { |
168 | - $result = self::$cache->add($this->getPrefix() . $key, $value, $ttl); |
|
168 | + $result = self::$cache->add($this->getPrefix().$key, $value, $ttl); |
|
169 | 169 | if (self::$cache->getResultCode() !== \Memcached::RES_NOTSTORED) { |
170 | 170 | $this->verifyReturnCode(); |
171 | 171 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function inc($key, $step = 1) { |
183 | 183 | $this->add($key, 0); |
184 | - $result = self::$cache->increment($this->getPrefix() . $key, $step); |
|
184 | + $result = self::$cache->increment($this->getPrefix().$key, $step); |
|
185 | 185 | |
186 | 186 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
187 | 187 | return false; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return int | bool |
199 | 199 | */ |
200 | 200 | public function dec($key, $step = 1) { |
201 | - $result = self::$cache->decrement($this->getPrefix() . $key, $step); |
|
201 | + $result = self::$cache->decrement($this->getPrefix().$key, $step); |
|
202 | 202 | |
203 | 203 | if (self::$cache->getResultCode() !== \Memcached::RES_SUCCESS) { |
204 | 204 | return false; |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | |
61 | 61 | $remoteStorages = $this->getRemoteStorages(); |
62 | 62 | |
63 | - $output->writeln(count($remoteStorages) . ' remote storage(s) need(s) to be checked'); |
|
63 | + $output->writeln(count($remoteStorages).' remote storage(s) need(s) to be checked'); |
|
64 | 64 | |
65 | 65 | $remoteShareIds = $this->getRemoteShareIds(); |
66 | 66 | |
67 | - $output->writeln(count($remoteShareIds) . ' remote share(s) exist'); |
|
67 | + $output->writeln(count($remoteShareIds).' remote share(s) exist'); |
|
68 | 68 | |
69 | 69 | foreach ($remoteShareIds as $id => $remoteShareId) { |
70 | 70 | if (isset($remoteStorages[$remoteShareId])) { |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | ->where($queryBuilder->expr()->like( |
143 | 143 | 'id', |
144 | 144 | // match all 'shared::' + 32 characters storages |
145 | - $queryBuilder->createNamedParameter($this->connection->escapeLikeParameter('shared::') . str_repeat('_', 32)), |
|
145 | + $queryBuilder->createNamedParameter($this->connection->escapeLikeParameter('shared::').str_repeat('_', 32)), |
|
146 | 146 | IQueryBuilder::PARAM_STR) |
147 | 147 | ) |
148 | 148 | ->andWhere($queryBuilder->expr()->notLike( |
149 | 149 | 'id', |
150 | 150 | // but not the ones starting with a '/', they are for normal shares |
151 | - $queryBuilder->createNamedParameter($this->connection->escapeLikeParameter('shared::/') . '%'), |
|
151 | + $queryBuilder->createNamedParameter($this->connection->escapeLikeParameter('shared::/').'%'), |
|
152 | 152 | IQueryBuilder::PARAM_STR) |
153 | 153 | )->orderBy('numeric_id'); |
154 | 154 | $query = $queryBuilder->execute(); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $remoteShareIds = []; |
173 | 173 | |
174 | 174 | while ($row = $query->fetch()) { |
175 | - $remoteShareIds[$row['id']] = 'shared::' . md5($row['share_token'] . '@' . $row['remote']); |
|
175 | + $remoteShareIds[$row['id']] = 'shared::'.md5($row['share_token'].'@'.$row['remote']); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | return $remoteShareIds; |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * pass all other function directly to the \Doctrine\DBAL\Driver\Statement |
56 | 56 | */ |
57 | - public function __call($name,$arguments) { |
|
58 | - return call_user_func_array(array($this->statement,$name), $arguments); |
|
57 | + public function __call($name, $arguments) { |
|
58 | + return call_user_func_array(array($this->statement, $name), $arguments); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @param array $input |
65 | 65 | * @return \OC_DB_StatementWrapper|int|bool |
66 | 66 | */ |
67 | - public function execute($input= []) { |
|
67 | + public function execute($input = []) { |
|
68 | 68 | $this->lastArguments = $input; |
69 | 69 | if (count($input) > 0) { |
70 | 70 | $result = $this->statement->execute($input); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param integer|null $length max length when using an OUT bind |
114 | 114 | * @return boolean |
115 | 115 | */ |
116 | - public function bindParam($column, &$variable, $type = null, $length = null){ |
|
116 | + public function bindParam($column, &$variable, $type = null, $length = null) { |
|
117 | 117 | return $this->statement->bindParam($column, $variable, $type, $length); |
118 | 118 | } |
119 | 119 | } |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | $this->logger = $logger; |
94 | 94 | $cachedGroups = & $this->cachedGroups; |
95 | 95 | $cachedUserGroups = & $this->cachedUserGroups; |
96 | - $this->listen('\OC\Group', 'postDelete', function ($group) use (&$cachedGroups, &$cachedUserGroups) { |
|
96 | + $this->listen('\OC\Group', 'postDelete', function($group) use (&$cachedGroups, &$cachedUserGroups) { |
|
97 | 97 | /** |
98 | 98 | * @var \OC\Group\Group $group |
99 | 99 | */ |
100 | 100 | unset($cachedGroups[$group->getGID()]); |
101 | 101 | $cachedUserGroups = array(); |
102 | 102 | }); |
103 | - $this->listen('\OC\Group', 'postAddUser', function ($group) use (&$cachedUserGroups) { |
|
103 | + $this->listen('\OC\Group', 'postAddUser', function($group) use (&$cachedUserGroups) { |
|
104 | 104 | /** |
105 | 105 | * @var \OC\Group\Group $group |
106 | 106 | */ |
107 | 107 | $cachedUserGroups = array(); |
108 | 108 | }); |
109 | - $this->listen('\OC\Group', 'postRemoveUser', function ($group) use (&$cachedUserGroups) { |
|
109 | + $this->listen('\OC\Group', 'postRemoveUser', function($group) use (&$cachedUserGroups) { |
|
110 | 110 | /** |
111 | 111 | * @var \OC\Group\Group $group |
112 | 112 | */ |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | if ($aGroup instanceof IGroup) { |
236 | 236 | $groups[$groupId] = $aGroup; |
237 | 237 | } else { |
238 | - $this->logger->debug('Group "' . $groupId . '" was returned by search but not found through direct access', ['app' => 'core']); |
|
238 | + $this->logger->debug('Group "'.$groupId.'" was returned by search but not found through direct access', ['app' => 'core']); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | if (!is_null($limit) and $limit <= 0) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @param IUser|null $user |
250 | 250 | * @return \OC\Group\Group[] |
251 | 251 | */ |
252 | - public function getUserGroups(IUser $user= null) { |
|
252 | + public function getUserGroups(IUser $user = null) { |
|
253 | 253 | if (!$user instanceof IUser) { |
254 | 254 | return []; |
255 | 255 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | if ($aGroup instanceof IGroup) { |
274 | 274 | $groups[$groupId] = $aGroup; |
275 | 275 | } else { |
276 | - $this->logger->debug('User "' . $uid . '" belongs to deleted group: "' . $groupId . '"', ['app' => 'core']); |
|
276 | + $this->logger->debug('User "'.$uid.'" belongs to deleted group: "'.$groupId.'"', ['app' => 'core']); |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | } |
@@ -322,32 +322,32 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { |
324 | 324 | $group = $this->get($gid); |
325 | - if(is_null($group)) { |
|
325 | + if (is_null($group)) { |
|
326 | 326 | return array(); |
327 | 327 | } |
328 | 328 | |
329 | 329 | $search = trim($search); |
330 | 330 | $groupUsers = array(); |
331 | 331 | |
332 | - if(!empty($search)) { |
|
332 | + if (!empty($search)) { |
|
333 | 333 | // only user backends have the capability to do a complex search for users |
334 | 334 | $searchOffset = 0; |
335 | 335 | $searchLimit = $limit * 100; |
336 | - if($limit === -1) { |
|
336 | + if ($limit === -1) { |
|
337 | 337 | $searchLimit = 500; |
338 | 338 | } |
339 | 339 | |
340 | 340 | do { |
341 | 341 | $filteredUsers = $this->userManager->searchDisplayName($search, $searchLimit, $searchOffset); |
342 | - foreach($filteredUsers as $filteredUser) { |
|
343 | - if($group->inGroup($filteredUser)) { |
|
344 | - $groupUsers[]= $filteredUser; |
|
342 | + foreach ($filteredUsers as $filteredUser) { |
|
343 | + if ($group->inGroup($filteredUser)) { |
|
344 | + $groupUsers[] = $filteredUser; |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | $searchOffset += $searchLimit; |
348 | - } while(count($groupUsers) < $searchLimit+$offset && count($filteredUsers) >= $searchLimit); |
|
348 | + } while (count($groupUsers) < $searchLimit + $offset && count($filteredUsers) >= $searchLimit); |
|
349 | 349 | |
350 | - if($limit === -1) { |
|
350 | + if ($limit === -1) { |
|
351 | 351 | $groupUsers = array_slice($groupUsers, $offset); |
352 | 352 | } else { |
353 | 353 | $groupUsers = array_slice($groupUsers, $offset, $limit); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | } |
358 | 358 | |
359 | 359 | $matchingUsers = array(); |
360 | - foreach($groupUsers as $groupUser) { |
|
360 | + foreach ($groupUsers as $groupUser) { |
|
361 | 361 | $matchingUsers[$groupUser->getUID()] = $groupUser->getDisplayName(); |
362 | 362 | } |
363 | 363 | return $matchingUsers; |