diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/user_ldap/lib/Jobs/Sync.php | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/user_ldap/lib/Jobs/Sync.php')
-rw-r--r-- | apps/user_ldap/lib/Jobs/Sync.php | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php index e095ba41bef..1ef2d16e7c2 100644 --- a/apps/user_ldap/lib/Jobs/Sync.php +++ b/apps/user_ldap/lib/Jobs/Sync.php @@ -122,20 +122,20 @@ class Sync extends TimedJob { $isBackgroundJobModeAjax = $this->config ->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'ajax'; - if($isBackgroundJobModeAjax) { + if ($isBackgroundJobModeAjax) { return; } $cycleData = $this->getCycle(); - if($cycleData === null) { + if ($cycleData === null) { $cycleData = $this->determineNextCycle(); - if($cycleData === null) { + if ($cycleData === null) { $this->updateInterval(); return; } } - if(!$this->qualifiesToRun($cycleData)) { + if (!$this->qualifiesToRun($cycleData)) { $this->updateInterval(); return; } @@ -175,7 +175,7 @@ class Sync extends TimedJob { true ); - if((int)$connection->ldapPagingSize === 0) { + if ((int)$connection->ldapPagingSize === 0) { return false; } return count($results) >= (int)$connection->ldapPagingSize; @@ -189,7 +189,7 @@ class Sync extends TimedJob { */ public function getCycle() { $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); - if(count($prefixes) === 0) { + if (count($prefixes) === 0) { return null; } @@ -198,7 +198,7 @@ class Sync extends TimedJob { 'offset' => (int)$this->config->getAppValue('user_ldap', 'background_sync_offset', 0), ]; - if( + if ( $cycleData['prefix'] !== null && in_array($cycleData['prefix'], $prefixes) ) { @@ -227,14 +227,14 @@ class Sync extends TimedJob { */ public function determineNextCycle(array $cycleData = null) { $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); - if(count($prefixes) === 0) { + if (count($prefixes) === 0) { return null; } // get the next prefix in line and remember it $oldPrefix = $cycleData === null ? null : $cycleData['prefix']; $prefix = $this->getNextPrefix($oldPrefix); - if($prefix === null) { + if ($prefix === null) { return null; } $cycleData['prefix'] = $prefix; @@ -253,7 +253,7 @@ class Sync extends TimedJob { */ public function qualifiesToRun($cycleData) { $lastChange = $this->config->getAppValue('user_ldap', $cycleData['prefix'] . '_lastChange', 0); - if((time() - $lastChange) > 60 * 30) { + if ((time() - $lastChange) > 60 * 30) { return true; } return false; @@ -279,17 +279,17 @@ class Sync extends TimedJob { protected function getNextPrefix($lastPrefix) { $prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true); $noOfPrefixes = count($prefixes); - if($noOfPrefixes === 0) { + if ($noOfPrefixes === 0) { return null; } $i = $lastPrefix === null ? false : array_search($lastPrefix, $prefixes, true); - if($i === false) { + if ($i === false) { $i = -1; } else { $i++; } - if(!isset($prefixes[$i])) { + if (!isset($prefixes[$i])) { $i = 0; } return $prefixes[$i]; @@ -301,49 +301,49 @@ class Sync extends TimedJob { * @param array $argument */ public function setArgument($argument) { - if(isset($argument['config'])) { + if (isset($argument['config'])) { $this->config = $argument['config']; } else { $this->config = \OC::$server->getConfig(); } - if(isset($argument['helper'])) { + if (isset($argument['helper'])) { $this->ldapHelper = $argument['helper']; } else { $this->ldapHelper = new Helper($this->config); } - if(isset($argument['ldapWrapper'])) { + if (isset($argument['ldapWrapper'])) { $this->ldap = $argument['ldapWrapper']; } else { $this->ldap = new LDAP(); } - if(isset($argument['avatarManager'])) { + if (isset($argument['avatarManager'])) { $this->avatarManager = $argument['avatarManager']; } else { $this->avatarManager = \OC::$server->getAvatarManager(); } - if(isset($argument['dbc'])) { + if (isset($argument['dbc'])) { $this->dbc = $argument['dbc']; } else { $this->dbc = \OC::$server->getDatabaseConnection(); } - if(isset($argument['ncUserManager'])) { + if (isset($argument['ncUserManager'])) { $this->ncUserManager = $argument['ncUserManager']; } else { $this->ncUserManager = \OC::$server->getUserManager(); } - if(isset($argument['notificationManager'])) { + if (isset($argument['notificationManager'])) { $this->notificationManager = $argument['notificationManager']; } else { $this->notificationManager = \OC::$server->getNotificationManager(); } - if(isset($argument['userManager'])) { + if (isset($argument['userManager'])) { $this->userManager = $argument['userManager']; } else { $this->userManager = new Manager( @@ -358,19 +358,19 @@ class Sync extends TimedJob { ); } - if(isset($argument['mapper'])) { + if (isset($argument['mapper'])) { $this->mapper = $argument['mapper']; } else { $this->mapper = new UserMapping($this->dbc); } - if(isset($argument['connectionFactory'])) { + if (isset($argument['connectionFactory'])) { $this->connectionFactory = $argument['connectionFactory']; } else { $this->connectionFactory = new ConnectionFactory($this->ldap); } - if(isset($argument['accessFactory'])) { + if (isset($argument['accessFactory'])) { $this->accessFactory = $argument['accessFactory']; } else { $this->accessFactory = new AccessFactory( |