@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | * @throws \InvalidArgumentException |
91 | 91 | */ |
92 | 92 | protected function validateOffsetAndLimit($offset, $limit) { |
93 | - if($limit < 0) { |
|
93 | + if ($limit < 0) { |
|
94 | 94 | throw new \InvalidArgumentException('limit must be 0 or greater'); |
95 | 95 | } |
96 | - if($offset < 0) { |
|
96 | + if ($offset < 0) { |
|
97 | 97 | throw new \InvalidArgumentException('offset must be 0 or greater'); |
98 | 98 | } |
99 | - if($limit === 0 && $offset !== 0) { |
|
99 | + if ($limit === 0 && $offset !== 0) { |
|
100 | 100 | throw new \InvalidArgumentException('offset must be 0 if limit is also set to 0'); |
101 | 101 | } |
102 | - if($offset > 0 && ($offset % $limit !== 0)) { |
|
102 | + if ($offset > 0 && ($offset % $limit !== 0)) { |
|
103 | 103 | throw new \InvalidArgumentException('offset must be a multiple of limit'); |
104 | 104 | } |
105 | 105 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
110 | 110 | $ldapWrapper = new LDAP(); |
111 | 111 | |
112 | - $offset = (int)$input->getOption('offset'); |
|
113 | - $limit = (int)$input->getOption('limit'); |
|
112 | + $offset = (int) $input->getOption('offset'); |
|
113 | + $limit = (int) $input->getOption('limit'); |
|
114 | 114 | $this->validateOffsetAndLimit($offset, $limit); |
115 | 115 | |
116 | - if($input->getOption('group')) { |
|
116 | + if ($input->getOption('group')) { |
|
117 | 117 | $proxy = new Group_Proxy($configPrefixes, $ldapWrapper, \OC::$server->query('LDAPGroupPluginManager')); |
118 | 118 | $getMethod = 'getGroups'; |
119 | 119 | $printID = false; |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | $result = $proxy->$getMethod($input->getArgument('search'), $limit, $offset); |
139 | - foreach($result as $id => $name) { |
|
140 | - $line = $name . ($printID ? ' ('.$id.')' : ''); |
|
139 | + foreach ($result as $id => $name) { |
|
140 | + $line = $name.($printID ? ' ('.$id.')' : ''); |
|
141 | 141 | $output->writeln($line); |
142 | 142 | } |
143 | 143 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return int |
167 | 167 | */ |
168 | 168 | public function getLastLogin() { |
169 | - return (int)$this->lastLogin; |
|
169 | + return (int) $this->lastLogin; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | * reads the user details |
182 | 182 | */ |
183 | 183 | protected function fetchDetails() { |
184 | - $properties = array ( |
|
184 | + $properties = array( |
|
185 | 185 | 'displayName' => 'user_ldap', |
186 | 186 | 'uid' => 'user_ldap', |
187 | 187 | 'homePath' => 'user_ldap', |
188 | 188 | 'email' => 'settings', |
189 | 189 | 'lastLogin' => 'login' |
190 | 190 | ); |
191 | - foreach($properties as $property => $app) { |
|
191 | + foreach ($properties as $property => $app) { |
|
192 | 192 | $this->$property = $this->config->getUserValue($this->ocName, $app, $property, ''); |
193 | 193 | } |
194 | 194 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | ', 1); |
212 | 212 | $query->execute(array($this->ocName)); |
213 | 213 | $sResult = $query->fetchColumn(0); |
214 | - if((int)$sResult === 1) { |
|
214 | + if ((int) $sResult === 1) { |
|
215 | 215 | $this->hasActiveShares = true; |
216 | 216 | return; |
217 | 217 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ', 1); |
224 | 224 | $query->execute(array($this->ocName)); |
225 | 225 | $sResult = $query->fetchColumn(0); |
226 | - if((int)$sResult === 1) { |
|
226 | + if ((int) $sResult === 1) { |
|
227 | 227 | $this->hasActiveShares = true; |
228 | 228 | return; |
229 | 229 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function run(IOutput $output) { |
73 | 73 | $installedVersion = $this->config->getAppValue('user_ldap', 'installed_version', '1.2.1'); |
74 | - if(version_compare($installedVersion, '1.2.1') !== -1) { |
|
74 | + if (version_compare($installedVersion, '1.2.1') !== -1) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | do { |
83 | 83 | $retry = false; |
84 | 84 | $records = $mapper->getList($offset, $batchSize); |
85 | - if(count($records) === 0){ |
|
85 | + if (count($records) === 0) { |
|
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | try { |
89 | 89 | $this->jobList->add($jobClass, ['records' => $records]); |
90 | 90 | $offset += $batchSize; |
91 | 91 | } catch (\InvalidArgumentException $e) { |
92 | - if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) { |
|
93 | - $batchSize = (int)floor(count($records) * 0.8); |
|
92 | + if (strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) { |
|
93 | + $batchSize = (int) floor(count($records) * 0.8); |
|
94 | 94 | $retry = true; |
95 | 95 | } |
96 | 96 | } |
@@ -32,13 +32,13 @@ |
||
32 | 32 | $serverConnections = $helper->getServerConfigurationPrefixes(); |
33 | 33 | sort($serverConnections); |
34 | 34 | $lk = array_pop($serverConnections); |
35 | -$ln = (int)str_replace('s', '', $lk); |
|
36 | -$nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT); |
|
35 | +$ln = (int) str_replace('s', '', $lk); |
|
36 | +$nk = 's'.str_pad($ln + 1, 2, '0', STR_PAD_LEFT); |
|
37 | 37 | |
38 | 38 | $resultData = array('configPrefix' => $nk); |
39 | 39 | |
40 | 40 | $newConfig = new \OCA\User_LDAP\Configuration($nk, false); |
41 | -if(isset($_POST['copyConfig'])) { |
|
41 | +if (isset($_POST['copyConfig'])) { |
|
42 | 42 | $originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']); |
43 | 43 | $newConfig->setConfiguration($originalConfig->getConfiguration()); |
44 | 44 | } else { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | use OCA\Files\Capabilities; |
35 | 35 | |
36 | 36 | class Application extends App { |
37 | - public function __construct(array $urlParams=array()) { |
|
37 | + public function __construct(array $urlParams = array()) { |
|
38 | 38 | parent::__construct('files', $urlParams); |
39 | 39 | $container = $this->getContainer(); |
40 | 40 | $server = $container->getServer(); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Controllers |
44 | 44 | */ |
45 | - $container->registerService('APIController', function (IContainer $c) use ($server) { |
|
45 | + $container->registerService('APIController', function(IContainer $c) use ($server) { |
|
46 | 46 | return new ApiController( |
47 | 47 | $c->query('AppName'), |
48 | 48 | $c->query('Request'), |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ); |
56 | 56 | }); |
57 | 57 | |
58 | - $container->registerService('ViewController', function (IContainer $c) use ($server) { |
|
58 | + $container->registerService('ViewController', function(IContainer $c) use ($server) { |
|
59 | 59 | return new ViewController( |
60 | 60 | $c->query('AppName'), |
61 | 61 | $c->query('Request'), |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * Services |
81 | 81 | */ |
82 | - $container->registerService('Tagger', function(IContainer $c) { |
|
82 | + $container->registerService('Tagger', function(IContainer $c) { |
|
83 | 83 | return $c->query('ServerContainer')->getTagManager()->load('files'); |
84 | 84 | }); |
85 | 85 | $container->registerService('TagService', function(IContainer $c) use ($server) { |
@@ -90,11 +90,11 @@ |
||
90 | 90 | */ |
91 | 91 | static private function renameChildren($oldPath, $newPath) { |
92 | 92 | |
93 | - $absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $newPath); |
|
94 | - $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $oldPath); |
|
93 | + $absNewPath = \OC\Files\Filesystem::normalizePath('/'.\OCP\User::getUser().'/files/'.$newPath); |
|
94 | + $absOldPath = \OC\Files\Filesystem::normalizePath('/'.\OCP\User::getUser().'/files/'.$oldPath); |
|
95 | 95 | |
96 | 96 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
97 | - $mountedShares = $mountManager->findIn('/' . \OCP\User::getUser() . '/files/' . $oldPath); |
|
97 | + $mountedShares = $mountManager->findIn('/'.\OCP\User::getUser().'/files/'.$oldPath); |
|
98 | 98 | foreach ($mountedShares as $mount) { |
99 | 99 | if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) { |
100 | 100 | $mountPoint = $mount->getMountPoint(); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | use OCP\IL10N; |
30 | 30 | |
31 | 31 | class Application extends App { |
32 | - public function __construct () { |
|
32 | + public function __construct() { |
|
33 | 33 | parent::__construct('user_ldap'); |
34 | 34 | $container = $this->getContainer(); |
35 | 35 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | |
71 | 71 | $container = $this->getContainer(); |
72 | 72 | |
73 | - $container->registerService(IUserMountCache::class, function (IAppContainer $c) { |
|
73 | + $container->registerService(IUserMountCache::class, function(IAppContainer $c) { |
|
74 | 74 | return $c->getServer()->query('UserMountCache'); |
75 | 75 | }); |
76 | 76 |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | |
46 | 46 | function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) { |
47 | 47 | $access = parent::checkPrivileges($uri, $privileges, $recursion, false); |
48 | - if($access === false && $throwExceptions) { |
|
48 | + if ($access === false && $throwExceptions) { |
|
49 | 49 | /** @var INode $node */ |
50 | 50 | $node = $this->server->tree->getNodeForPath($uri); |
51 | 51 | |
52 | - switch(get_class($node)) { |
|
52 | + switch (get_class($node)) { |
|
53 | 53 | case AddressBook::class: |
54 | 54 | $type = 'Addressbook'; |
55 | 55 | break; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function propFind(PropFind $propFind, INode $node) { |
73 | 73 | // If the node is neither readable nor writable then fail unless its of |
74 | 74 | // the standard user-principal |
75 | - if(!($node instanceof User)) { |
|
75 | + if (!($node instanceof User)) { |
|
76 | 76 | $path = $propFind->getPath(); |
77 | 77 | $readPermissions = $this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false); |
78 | 78 | $writePermissions = $this->checkPrivileges($path, '{DAV:}write', self::R_PARENT, false); |