diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-26 12:36:25 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-01-26 12:36:25 +0100 |
commit | 6bbea33133867c0fc7dc0ab1df74a38c30843141 (patch) | |
tree | 035b6310da06ca747733c36b5c09d0c97b886e22 /lib | |
parent | 26682b6936dcc127393655754500a1848d28c7d0 (diff) | |
download | nextcloud-server-6bbea33133867c0fc7dc0ab1df74a38c30843141.tar.gz nextcloud-server-6bbea33133867c0fc7dc0ab1df74a38c30843141.zip |
Simplify ternary operator statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Encryption/Util.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 4 | ||||
-rw-r--r-- | lib/private/Memcache/Redis.php | 4 | ||||
-rw-r--r-- | lib/private/Settings/Admin/Sharing.php | 2 | ||||
-rw-r--r-- | lib/private/Share/Helper.php | 2 | ||||
-rw-r--r-- | lib/private/Share/Share.php | 8 | ||||
-rw-r--r-- | lib/private/SubAdmin.php | 4 | ||||
-rw-r--r-- | lib/private/Template/JSConfigHelper.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/util.php | 4 |
9 files changed, 15 insertions, 17 deletions
diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index 047ef1626df..fc0adbbd47b 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -384,7 +384,7 @@ class Util { public function recoveryEnabled($uid) { $enabled = $this->config->getUserValue($uid, 'encryption', 'recovery_enabled', '0'); - return ($enabled === '1') ? true : false; + return $enabled === '1'; } /** diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index d443ccfd49b..e40a4830953 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -379,7 +379,7 @@ class Encryption extends Wrapper { $shouldEncrypt = false; $encryptionModule = null; $header = $this->getHeader($path); - $signed = (isset($header['signed']) && $header['signed'] === 'true') ? true : false; + $signed = isset($header['signed']) && $header['signed'] === 'true'; $fullPath = $this->getFullPath($path); $encryptionModuleId = $this->util->getEncryptionModuleId($header); @@ -544,7 +544,7 @@ class Encryption extends Wrapper { return 0; } - $signed = (isset($header['signed']) && $header['signed'] === 'true') ? true : false; + $signed = isset($header['signed']) && $header['signed'] === 'true'; $unencryptedBlockSize = $encryptionModule->getUnencryptedBlockSize($signed); // calculate last chunk nr diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index 9cc61114b00..adf3c5050bd 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -145,7 +145,7 @@ class Redis extends Cache implements IMemcacheTTL { $result = self::$cache->multi() ->set($this->getNameSpace() . $key, $new) ->exec(); - return ($result === false) ? false : true; + return $result !== false; } self::$cache->unwatch(); return false; @@ -164,7 +164,7 @@ class Redis extends Cache implements IMemcacheTTL { $result = self::$cache->multi() ->del($this->getNameSpace() . $key) ->exec(); - return ($result === false) ? false : true; + return $result !== false; } self::$cache->unwatch(); return false; diff --git a/lib/private/Settings/Admin/Sharing.php b/lib/private/Settings/Admin/Sharing.php index a99ba453d67..dbdacf78dab 100644 --- a/lib/private/Settings/Admin/Sharing.php +++ b/lib/private/Settings/Admin/Sharing.php @@ -64,7 +64,7 @@ class Sharing implements ISettings { 'shareDefaultExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'), 'shareExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'), 'shareEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'), - 'shareExcludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false, + 'shareExcludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes', 'shareExcludedGroupsList' => $excludeGroupsList, 'publicShareDisclaimerText' => $this->config->getAppValue('core', 'shareapi_public_link_disclaimertext', null), 'enableLinkPasswordByDefault' => $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'), diff --git a/lib/private/Share/Helper.php b/lib/private/Share/Helper.php index a1a56077d40..2eba67004dd 100644 --- a/lib/private/Share/Helper.php +++ b/lib/private/Share/Helper.php @@ -169,7 +169,7 @@ class Helper extends \OC\Share\Constants { $enforceExpireDate = $config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'); $defaultExpireSettings['defaultExpireDateSet'] = true; $defaultExpireSettings['expireAfterDays'] = (int)($config->getAppValue('core', 'shareapi_expire_after_n_days', '7')); - $defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes' ? true : false; + $defaultExpireSettings['enforceExpireDate'] = $enforceExpireDate === 'yes'; } return $defaultExpireSettings; diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 8812399c812..35d84307548 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -1416,7 +1416,7 @@ class Share extends Constants { */ protected static function groupItems($items, $itemType) { - $fileSharing = ($itemType === 'file' || $itemType === 'folder') ? true : false; + $fileSharing = $itemType === 'file' || $itemType === 'folder'; $result = array(); @@ -2070,7 +2070,7 @@ class Share extends Constants { */ public static function shareWithGroupMembersOnly() { $value = \OC::$server->getConfig()->getAppValue('core', 'shareapi_only_share_with_group_members', 'no'); - return ($value === 'yes') ? true : false; + return $value === 'yes'; } /** @@ -2078,7 +2078,7 @@ class Share extends Constants { */ public static function isDefaultExpireDateEnabled() { $defaultExpireDateEnabled = \OC::$server->getConfig()->getAppValue('core', 'shareapi_default_expire_date', 'no'); - return ($defaultExpireDateEnabled === "yes") ? true : false; + return $defaultExpireDateEnabled === 'yes'; } /** @@ -2119,7 +2119,7 @@ class Share extends Constants { */ public static function enforcePassword(IConfig $config) { $enforcePassword = $config->getAppValue('core', 'shareapi_enforce_links_password', 'no'); - return ($enforcePassword === "yes") ? true : false; + return $enforcePassword === 'yes'; } /** diff --git a/lib/private/SubAdmin.php b/lib/private/SubAdmin.php index d92c8d01605..cd16d07e43d 100644 --- a/lib/private/SubAdmin.php +++ b/lib/private/SubAdmin.php @@ -230,9 +230,7 @@ class SubAdmin extends PublicEmitter { $isSubAdmin = $result->fetch(); $result->closeCursor(); - $result = $isSubAdmin === false ? false : true; - - return $result; + return $isSubAdmin !== false; } /** diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 65068973e40..ab52704d1e2 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -122,7 +122,7 @@ class JSConfigHelper { $enableLinkPasswordByDefault = $this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no'); - $enableLinkPasswordByDefault = ($enableLinkPasswordByDefault === 'yes') ? true : false; + $enableLinkPasswordByDefault = $enableLinkPasswordByDefault === 'yes'; $defaultExpireDateEnabled = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; $defaultExpireDate = $enforceDefaultExpireDate = null; if ($defaultExpireDateEnabled) { diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index 776a879e731..efa488b434d 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -301,7 +301,7 @@ class OC_Util { */ public static function isPublicLinkPasswordRequired() { $enforcePassword = \OC::$server->getConfig()->getAppValue('core', 'shareapi_enforce_links_password', 'no'); - return ($enforcePassword === 'yes') ? true : false; + return $enforcePassword === 'yes'; } /** @@ -344,7 +344,7 @@ class OC_Util { $enforceDefaultExpireDate = false; if ($isDefaultExpireDateEnabled === 'yes') { $value = \OC::$server->getConfig()->getAppValue('core', 'shareapi_enforce_expire_date', 'no'); - $enforceDefaultExpireDate = ($value === 'yes') ? true : false; + $enforceDefaultExpireDate = $value === 'yes'; } return $enforceDefaultExpireDate; |