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); $redirect = Redirect::to($redirectUrl);
} else { } else {
// Process relative redirects // Process relative redirects
$redirect = ($redirectUrl) ? Backend::redirect($redirectUrl) : null; $redirect = $redirectUrl ? Backend::redirect($redirectUrl) : null;
} }
return $redirect; return $redirect;

View File

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

View File

@ -136,7 +136,7 @@ class BackendController extends ControllerBase
$controller = Str::normalizeClassName($controller); $controller = Str::normalizeClassName($controller);
$controllerFile = $inPath.strtolower(str_replace('\\', '/', $controller)) . '.php'; $controllerFile = $inPath.strtolower(str_replace('\\', '/', $controller)) . '.php';
if ($controllerFile = File::existsInsensitive($controllerFile)) { 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)) { if (($widget = $this->widget->{$widgetName}) && $widget->methodExists($handlerName)) {
$result = $this->runAjaxHandlerForWidget($widget, $handlerName); $result = $this->runAjaxHandlerForWidget($widget, $handlerName);
return ($result) ?: true; return $result ?: true;
} }
} }
else { else {
@ -531,7 +531,7 @@ class Controller extends Extendable
if ($this->methodExists($pageHandler)) { if ($this->methodExists($pageHandler)) {
$result = call_user_func_array([$this, $pageHandler], $this->params); $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)) { if ($this->methodExists($handler)) {
$result = call_user_func_array([$this, $handler], $this->params); $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) { foreach ((array) $this->widget as $widget) {
if ($widget->methodExists($handler)) { if ($widget->methodExists($handler)) {
$result = $this->runAjaxHandlerForWidget($widget, $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 no alias is set by the configuration.
*/ */
if (!isset($this->alias)) { 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 = ''; $cssDimensions = '';
if ($mode == 'block') { if ($mode == 'block') {
$cssDimensions .= ($this->imageWidth) $cssDimensions .= $this->imageWidth
? 'width: '.$this->imageWidth.'px;' ? 'width: '.$this->imageWidth.'px;'
: 'width: '.$this->imageHeight.'px;'; : 'width: '.$this->imageHeight.'px;';
$cssDimensions .= ($this->imageHeight) $cssDimensions .= $this->imageHeight
? 'height: '.$this->imageHeight.'px;' ? 'height: '.$this->imageHeight.'px;'
: 'height: auto;'; : 'height: auto;';
} }
else { else {
$cssDimensions .= ($this->imageWidth) $cssDimensions .= $this->imageWidth
? 'width: '.$this->imageWidth.'px;' ? 'width: '.$this->imageWidth.'px;'
: 'width: auto;'; : 'width: auto;';
$cssDimensions .= ($this->imageHeight) $cssDimensions .= $this->imageHeight
? 'height: '.$this->imageHeight.'px;' ? 'height: '.$this->imageHeight.'px;'
: 'height: auto;'; : 'height: auto;';
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -75,6 +75,6 @@ class File extends FileBase
protected function copyLocalToStorage($localPath, $storagePath) protected function copyLocalToStorage($localPath, $storagePath)
{ {
$disk = Storage::disk(Config::get('cms.storage.uploads.disk')); $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)); $classFolder = strtolower(class_basename($class));
$classFile = realpath(dirname(File::fromClass($class))); $classFile = realpath(dirname(File::fromClass($class)));
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null; $guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return ($isPublic) ? File::localToPublic($guessedPath) : $guessedPath; return $isPublic ? File::localToPublic($guessedPath) : $guessedPath;
} }
} }