Simplify ternary operator statements
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
26682b6936
commit
6bbea33133
13 changed files with 19 additions and 23 deletions
|
@ -110,9 +110,7 @@ class AjaxController extends Controller {
|
|||
$currentUser = $this->userSession->getUser();
|
||||
|
||||
// Non-admins can only edit their own credentials
|
||||
$allowedToEdit = (
|
||||
$this->groupManager->isAdmin($currentUser->getUID()) || $currentUser->getUID() === $uid
|
||||
) ? true : false;
|
||||
$allowedToEdit = ($this->groupManager->isAdmin($currentUser->getUID()) || $currentUser->getUID() === $uid);
|
||||
|
||||
if ($allowedToEdit) {
|
||||
$this->globalAuth->saveAuth($uid, $user, $password);
|
||||
|
|
|
@ -348,7 +348,7 @@ class ShareController extends Controller {
|
|||
$freeSpace = (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
|
||||
}
|
||||
|
||||
$hideFileList = $share->getPermissions() & \OCP\Constants::PERMISSION_READ ? false : true;
|
||||
$hideFileList = !($share->getPermissions() & \OCP\Constants::PERMISSION_READ);
|
||||
$maxUploadFilesize = $freeSpace;
|
||||
|
||||
$folder = new Template('files', 'list', '');
|
||||
|
|
|
@ -156,7 +156,7 @@ class CleanUp extends TimedJob {
|
|||
* @return bool
|
||||
*/
|
||||
public function isOffsetResetNecessary($resultCount) {
|
||||
return ($resultCount < $this->limit) ? true : false;
|
||||
return $resultCount < $this->limit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -230,9 +230,7 @@ class SubAdmin extends PublicEmitter {
|
|||
$isSubAdmin = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
$result = $isSubAdmin === false ? false : true;
|
||||
|
||||
return $result;
|
||||
return $isSubAdmin !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -205,7 +205,7 @@ class AppSettingsController extends Controller {
|
|||
$nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion();
|
||||
}
|
||||
$phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']);
|
||||
$existsLocally = (\OC_App::getAppPath($app['id']) !== false) ? true : false;
|
||||
$existsLocally = \OC_App::getAppPath($app['id']) !== false;
|
||||
$phpDependencies = [];
|
||||
if($phpVersion->getMinimumVersion() !== '') {
|
||||
$phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion();
|
||||
|
|
Loading…
Reference in a new issue