Remove unnecessary parentheses

This commit is contained in:
Nathan van der Werf 2018-08-15 18:49:52 +02:00
parent a075be206b
commit 123145fd54
13 changed files with 29 additions and 29 deletions

View File

@ -472,7 +472,7 @@ class FormController extends ControllerBehavior
$redirect = Redirect::to($redirectUrl);
} else {
// Process relative redirects
$redirect = ($redirectUrl) ? Backend::redirect($redirectUrl) : null;
$redirect = $redirectUrl ? Backend::redirect($redirectUrl) : null;
}
return $redirect;

View File

@ -421,7 +421,7 @@ class RelationController extends ControllerBehavior
/*
* Determine the partial to use based on the supplied section option
*/
$section = (isset($options['section'])) ? $options['section'] : null;
$section = isset($options['section']) ? $options['section'] : null;
switch (strtolower($section)) {
case 'toolbar':
return $this->toolbarWidget ? $this->toolbarWidget->render() : null;

View File

@ -136,7 +136,7 @@ class BackendController extends ControllerBase
$controller = Str::normalizeClassName($controller);
$controllerFile = $inPath.strtolower(str_replace('\\', '/', $controller)) . '.php';
if ($controllerFile = File::existsInsensitive($controllerFile)) {
include_once($controllerFile);
include_once $controllerFile;
}
}

View File

@ -520,7 +520,7 @@ class Controller extends Extendable
if (($widget = $this->widget->{$widgetName}) && $widget->methodExists($handlerName)) {
$result = $this->runAjaxHandlerForWidget($widget, $handlerName);
return ($result) ?: true;
return $result ?: true;
}
}
else {
@ -531,7 +531,7 @@ class Controller extends Extendable
if ($this->methodExists($pageHandler)) {
$result = call_user_func_array([$this, $pageHandler], $this->params);
return ($result) ?: true;
return $result ?: true;
}
/*
@ -539,7 +539,7 @@ class Controller extends Extendable
*/
if ($this->methodExists($handler)) {
$result = call_user_func_array([$this, $handler], $this->params);
return ($result) ?: true;
return $result ?: true;
}
/*
@ -551,7 +551,7 @@ class Controller extends Extendable
foreach ((array) $this->widget as $widget) {
if ($widget->methodExists($handler)) {
$result = $this->runAjaxHandlerForWidget($widget, $handler);
return ($result) ?: true;
return $result ?: true;
}
}
}

View File

@ -65,7 +65,7 @@ abstract class WidgetBase extends Extendable
* If no alias is set by the configuration.
*/
if (!isset($this->alias)) {
$this->alias = (isset($this->config->alias)) ? $this->config->alias : $this->defaultAlias;
$this->alias = isset($this->config->alias) ? $this->config->alias : $this->defaultAlias;
}
/*

View File

@ -207,20 +207,20 @@ class FileUpload extends FormWidgetBase
$cssDimensions = '';
if ($mode == 'block') {
$cssDimensions .= ($this->imageWidth)
$cssDimensions .= $this->imageWidth
? 'width: '.$this->imageWidth.'px;'
: 'width: '.$this->imageHeight.'px;';
$cssDimensions .= ($this->imageHeight)
$cssDimensions .= $this->imageHeight
? 'height: '.$this->imageHeight.'px;'
: 'height: auto;';
}
else {
$cssDimensions .= ($this->imageWidth)
$cssDimensions .= $this->imageWidth
? 'width: '.$this->imageWidth.'px;'
: 'width: auto;';
$cssDimensions .= ($this->imageHeight)
$cssDimensions .= $this->imageHeight
? 'height: '.$this->imageHeight.'px;'
: 'height: auto;';
}

View File

@ -524,7 +524,7 @@ class Filter extends WidgetBase
* Check that the filter scope matches the active context
*/
if ($scopeObj->context !== null) {
$context = (is_array($scopeObj->context)) ? $scopeObj->context : [$scopeObj->context];
$context = is_array($scopeObj->context) ? $scopeObj->context : [$scopeObj->context];
if (!in_array($this->getContext(), $context)) {
continue;
}
@ -584,7 +584,7 @@ class Filter extends WidgetBase
*/
protected function makeFilterScope($name, $config)
{
$label = (isset($config['label'])) ? $config['label'] : null;
$label = isset($config['label']) ? $config['label'] : null;
$scopeType = isset($config['type']) ? $config['type'] : null;
$scope = new FilterScope($name, $label);

View File

@ -550,7 +550,7 @@ class Form extends WidgetBase
* Check that the form field matches the active context
*/
if ($fieldObj->context !== null) {
$context = (is_array($fieldObj->context)) ? $fieldObj->context : [$fieldObj->context];
$context = is_array($fieldObj->context) ? $fieldObj->context : [$fieldObj->context];
if (!in_array($this->getContext(), $context)) {
continue;
}
@ -643,7 +643,7 @@ class Form extends WidgetBase
*/
protected function makeFormField($name, $config = [])
{
$label = (isset($config['label'])) ? $config['label'] : null;
$label = isset($config['label']) ? $config['label'] : null;
list($fieldName, $fieldContext) = $this->getFieldName($name);
$field = new FormField($fieldName, $label);

View File

@ -106,7 +106,7 @@ class ComponentHelpers
public static function getComponentName($component)
{
$details = $component->componentDetails();
$name = (isset($details['name']))
$name = isset($details['name'])
? $details['name']
: 'cms::lang.component.unnamed';
@ -121,7 +121,7 @@ class ComponentHelpers
public static function getComponentDescription($component)
{
$details = $component->componentDetails();
$name = (isset($details['description']))
$name = isset($details['description'])
? $details['description']
: 'cms::lang.component.no_description';

View File

@ -332,7 +332,7 @@ class Controller
if (
$useAjax &&
($handler = post('_handler')) &&
($this->verifyCsrfToken()) &&
$this->verifyCsrfToken() &&
($handlerResponse = $this->runAjaxHandler($handler)) &&
$handlerResponse !== true
) {
@ -717,7 +717,7 @@ class Controller
if ($componentObj && $componentObj->methodExists($handlerName)) {
$this->componentContext = $componentObj;
$result = $componentObj->runAjaxHandler($handlerName);
return ($result) ?: true;
return $result ?: true;
}
}
/*
@ -726,12 +726,12 @@ class Controller
else {
if (method_exists($this->pageObj, $handler)) {
$result = $this->pageObj->$handler();
return ($result) ?: true;
return $result ?: true;
}
if (!$this->layout->isFallBack() && method_exists($this->layoutObj, $handler)) {
$result = $this->layoutObj->$handler();
return ($result) ?: true;
return $result ?: true;
}
/*
@ -740,7 +740,7 @@ class Controller
if (($componentObj = $this->findComponentByHandler($handler)) !== null) {
$this->componentContext = $componentObj;
$result = $componentObj->runAjaxHandler($handler);
return ($result) ?: true;
return $result ?: true;
}
}

View File

@ -79,7 +79,7 @@ class VersionManager
*/
public function updatePlugin($plugin, $stopOnVersion = null)
{
$code = (is_string($plugin)) ? $plugin : $this->pluginManager->getIdentifier($plugin);
$code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin);
if (!$this->hasVersionFile($code)) {
return false;
@ -111,7 +111,7 @@ class VersionManager
*/
public function listNewVersions($plugin)
{
$code = (is_string($plugin)) ? $plugin : $this->pluginManager->getIdentifier($plugin);
$code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin);
if (!$this->hasVersionFile($code)) {
return [];
@ -165,7 +165,7 @@ class VersionManager
*/
public function removePlugin($plugin, $stopOnVersion = null)
{
$code = (is_string($plugin)) ? $plugin : $this->pluginManager->getIdentifier($plugin);
$code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin);
if (!$this->hasVersionFile($code)) {
return false;
@ -327,7 +327,7 @@ class VersionManager
;
}
return (isset($this->databaseVersions[$code]))
return isset($this->databaseVersions[$code])
? $this->databaseVersions[$code]
: self::NO_VERSION_VALUE;
}

View File

@ -75,6 +75,6 @@ class File extends FileBase
protected function copyLocalToStorage($localPath, $storagePath)
{
$disk = Storage::disk(Config::get('cms.storage.uploads.disk'));
return $disk->put($storagePath, FileHelper::get($localPath), ($this->isPublic()) ? 'public' : null);
return $disk->put($storagePath, FileHelper::get($localPath), $this->isPublic() ? 'public' : null);
}
}

View File

@ -300,6 +300,6 @@ trait ViewMaker
$classFolder = strtolower(class_basename($class));
$classFile = realpath(dirname(File::fromClass($class)));
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return ($isPublic) ? File::localToPublic($guessedPath) : $guessedPath;
return $isPublic ? File::localToPublic($guessedPath) : $guessedPath;
}
}