@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | * @return mixed |
53 | 53 | */ |
54 | 54 | public function connect($host, $port) { |
55 | - if(strpos($host, '://') === false) { |
|
56 | - $host = 'ldap://' . $host; |
|
55 | + if (strpos($host, '://') === false) { |
|
56 | + $host = 'ldap://'.$host; |
|
57 | 57 | } |
58 | - if(strpos($host, ':', strpos($host, '://') + 1) === false) { |
|
58 | + if (strpos($host, ':', strpos($host, '://') + 1) === false) { |
|
59 | 59 | //ldap_connect ignores port parameter when URLs are passed |
60 | - $host .= ':' . $port; |
|
60 | + $host .= ':'.$port; |
|
61 | 61 | } |
62 | 62 | return $this->invokeLDAPMethod('connect', $host); |
63 | 63 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0) { |
195 | 195 | $oldHandler = set_error_handler(function($no, $message, $file, $line) use (&$oldHandler) { |
196 | - if(strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) { |
|
196 | + if (strpos($message, 'Partial search results returned: Sizelimit exceeded') !== false) { |
|
197 | 197 | return true; |
198 | 198 | } |
199 | 199 | $oldHandler($no, $message, $file, $line); |
@@ -272,13 +272,13 @@ discard block |
||
272 | 272 | * @return bool |
273 | 273 | */ |
274 | 274 | protected function isResultFalse($result) { |
275 | - if($result === false) { |
|
275 | + if ($result === false) { |
|
276 | 276 | return true; |
277 | 277 | } |
278 | 278 | |
279 | - if($this->curFunc === 'ldap_search' && is_array($result)) { |
|
279 | + if ($this->curFunc === 'ldap_search' && is_array($result)) { |
|
280 | 280 | foreach ($result as $singleResult) { |
281 | - if($singleResult === false) { |
|
281 | + if ($singleResult === false) { |
|
282 | 282 | return true; |
283 | 283 | } |
284 | 284 | } |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | */ |
293 | 293 | protected function invokeLDAPMethod() { |
294 | 294 | $arguments = func_get_args(); |
295 | - $func = 'ldap_' . array_shift($arguments); |
|
296 | - if(function_exists($func)) { |
|
295 | + $func = 'ldap_'.array_shift($arguments); |
|
296 | + if (function_exists($func)) { |
|
297 | 297 | $this->preFunctionCall($func, $arguments); |
298 | 298 | $result = call_user_func_array($func, $arguments); |
299 | 299 | if ($this->isResultFalse($result)) { |
@@ -323,12 +323,12 @@ discard block |
||
323 | 323 | */ |
324 | 324 | private function processLDAPError($resource) { |
325 | 325 | $errorCode = ldap_errno($resource); |
326 | - if($errorCode === 0) { |
|
326 | + if ($errorCode === 0) { |
|
327 | 327 | return; |
328 | 328 | } |
329 | - $errorMsg = ldap_error($resource); |
|
329 | + $errorMsg = ldap_error($resource); |
|
330 | 330 | |
331 | - if($this->curFunc === 'ldap_get_entries' |
|
331 | + if ($this->curFunc === 'ldap_get_entries' |
|
332 | 332 | && $errorCode === -4) { |
333 | 333 | } else if ($errorCode === 32) { |
334 | 334 | //for now |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | throw new \Exception('LDAP Operations error', $errorCode); |
345 | 345 | } else if ($errorCode === 19) { |
346 | 346 | ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error); |
347 | - throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode); |
|
347 | + throw new ConstraintViolationException(!empty($extended_error) ? $extended_error : $errorMsg, $errorCode); |
|
348 | 348 | } else { |
349 | 349 | \OC::$server->getLogger()->debug('LDAP error {message} ({code}) after calling {func}', [ |
350 | 350 | 'app' => 'user_ldap', |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | * @throw \Exception |
361 | 361 | */ |
362 | 362 | private function postFunctionCall() { |
363 | - if($this->isResource($this->curArgs[0])) { |
|
363 | + if ($this->isResource($this->curArgs[0])) { |
|
364 | 364 | $resource = $this->curArgs[0]; |
365 | - } else if( |
|
365 | + } else if ( |
|
366 | 366 | $this->curFunc === 'ldap_search' |
367 | 367 | && is_array($this->curArgs[0]) |
368 | 368 | && $this->isResource($this->curArgs[0][0]) |