@@ -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 | } |
@@ -267,13 +267,13 @@ discard block |
||
267 | 267 | * @return bool |
268 | 268 | */ |
269 | 269 | protected function isResultFalse($result) { |
270 | - if($result === false) { |
|
270 | + if ($result === false) { |
|
271 | 271 | return true; |
272 | 272 | } |
273 | 273 | |
274 | - if($this->curFunc === 'ldap_search' && is_array($result)) { |
|
274 | + if ($this->curFunc === 'ldap_search' && is_array($result)) { |
|
275 | 275 | foreach ($result as $singleResult) { |
276 | - if($singleResult === false) { |
|
276 | + if ($singleResult === false) { |
|
277 | 277 | return true; |
278 | 278 | } |
279 | 279 | } |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | */ |
288 | 288 | protected function invokeLDAPMethod() { |
289 | 289 | $arguments = func_get_args(); |
290 | - $func = 'ldap_' . array_shift($arguments); |
|
291 | - if(function_exists($func)) { |
|
290 | + $func = 'ldap_'.array_shift($arguments); |
|
291 | + if (function_exists($func)) { |
|
292 | 292 | $this->preFunctionCall($func, $arguments); |
293 | 293 | $result = call_user_func_array($func, $arguments); |
294 | 294 | if ($this->isResultFalse($result)) { |
@@ -318,12 +318,12 @@ discard block |
||
318 | 318 | */ |
319 | 319 | private function processLDAPError($resource) { |
320 | 320 | $errorCode = ldap_errno($resource); |
321 | - if($errorCode === 0) { |
|
321 | + if ($errorCode === 0) { |
|
322 | 322 | return; |
323 | 323 | } |
324 | - $errorMsg = ldap_error($resource); |
|
324 | + $errorMsg = ldap_error($resource); |
|
325 | 325 | |
326 | - if($this->curFunc === 'ldap_get_entries' |
|
326 | + if ($this->curFunc === 'ldap_get_entries' |
|
327 | 327 | && $errorCode === -4) { |
328 | 328 | } else if ($errorCode === 32) { |
329 | 329 | //for now |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | throw new \Exception('LDAP Operations error', $errorCode); |
340 | 340 | } else if ($errorCode === 19) { |
341 | 341 | ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error); |
342 | - throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode); |
|
342 | + throw new ConstraintViolationException(!empty($extended_error) ? $extended_error : $errorMsg, $errorCode); |
|
343 | 343 | } else { |
344 | 344 | \OC::$server->getLogger()->debug('LDAP error {message} ({code}) after calling {func}', [ |
345 | 345 | 'app' => 'user_ldap', |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | * Called after an ldap method is run to act on LDAP error if necessary |
355 | 355 | */ |
356 | 356 | private function postFunctionCall() { |
357 | - if($this->isResource($this->curArgs[0])) { |
|
357 | + if ($this->isResource($this->curArgs[0])) { |
|
358 | 358 | $resource = $this->curArgs[0]; |
359 | - } else if( |
|
359 | + } else if ( |
|
360 | 360 | $this->curFunc === 'ldap_search' |
361 | 361 | && is_array($this->curArgs[0]) |
362 | 362 | && $this->isResource($this->curArgs[0][0]) |