diff options
author | brantje <brantje@gmail.com> | 2017-01-03 23:12:24 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2017-01-03 23:33:00 +0300 |
commit | f30f986d608133facd61920bf4a6a64dd75ae99a (patch) | |
tree | 85296a07b81340ba00b9802cded29d5b45439d12 /lib | |
parent | 0de232ffabe62971a9c108e36dd376fd833c07d2 (diff) |
Fix if statements
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Db/SharingACLMapper.php | 10 | ||||
-rw-r--r-- | lib/Service/CredentialService.php | 3 | ||||
-rw-r--r-- | lib/Service/CronService.php | 3 | ||||
-rw-r--r-- | lib/Service/SettingsService.php | 14 |
4 files changed, 11 insertions, 19 deletions
diff --git a/lib/Db/SharingACLMapper.php b/lib/Db/SharingACLMapper.php index 66246426..e251a0c4 100644 --- a/lib/Db/SharingACLMapper.php +++ b/lib/Db/SharingACLMapper.php @@ -60,13 +60,11 @@ class SharingACLMapper extends Mapper { public function getItemACL($user_id, $item_guid) { $q = "SELECT * FROM " . self::TABLE_NAME . " WHERE item_guid = ? AND "; $filter = [$item_guid]; - if ($user_id === null){ - $q .= 'user_id is null'; - } - else { - $q .= 'user_id = ? '; - $filter[] = $user_id; + $q .= ($user_id === null) ? 'user_id is null' : 'user_id = ? '; + if ($user_id !== null){ + $filter[] = $user_id; } + return $this->findEntity($q, $filter); } diff --git a/lib/Service/CredentialService.php b/lib/Service/CredentialService.php index 3fb61113..9590bb0e 100644 --- a/lib/Service/CredentialService.php +++ b/lib/Service/CredentialService.php @@ -125,9 +125,8 @@ class CredentialService { $acl = $this->sharingACL->getItemACL($user_id, $credential->getGuid()); if ($acl->hasPermission(SharingACL::READ)) { return $credential; - } else { - throw new DoesNotExistException("Did expect one result but found none when executing"); } + throw new DoesNotExistException("Did expect one result but found none when executing"); } } diff --git a/lib/Service/CronService.php b/lib/Service/CronService.php index 3ee3660e..ca114166 100644 --- a/lib/Service/CronService.php +++ b/lib/Service/CronService.php @@ -65,10 +65,7 @@ class CronService { '', array(), $link, $credential->getUserId(), Activity::TYPE_ITEM_EXPIRED); $this->notificationService->credentialExpiredNotification($credential); - } else { - $this->logger->debug($credential->getLabel() .' is expired, already notified!', array('app' => 'passman')); } - } } }
\ No newline at end of file diff --git a/lib/Service/SettingsService.php b/lib/Service/SettingsService.php index ae486373..813a994e 100644 --- a/lib/Service/SettingsService.php +++ b/lib/Service/SettingsService.php @@ -39,7 +39,8 @@ class SettingsService { 'vault_key_strength', 'check_version', 'https_check', - 'disable_contextmenu' + 'disable_contextmenu', + 'settings_loaded' ); public function __construct($UserId, IConfig $config, $AppName) { @@ -74,14 +75,11 @@ class SettingsService { * @return mixed */ public function getAppSetting($key, $default_value = null) { - if (isset($this->settings[$key])) { - $value = $this->settings[$key]; - if (in_array($key, $this->numeric_settings)) { - $value = intval($value); - } - } else { - $value = $this->config->getAppValue('passman', $key, $default_value); + $value = ($this->settings[$key]) ? $this->settings[$key] : $this->config->getAppValue('passman', $key, $default_value); + if (in_array($key, $this->numeric_settings)) { + $value = intval($value); } + return $value; } |