Remove redundant variables

This commit is contained in:
Nathan van der Werf 2018-08-15 19:23:12 +02:00
parent ab73442e3d
commit fbca3bea92
16 changed files with 20 additions and 46 deletions

View File

@ -436,8 +436,7 @@ class FormController extends ControllerBehavior
protected function createModel()
{
$class = $this->config->modelClass;
$model = new $class;
return $model;
return new $class;
}
/**

View File

@ -695,8 +695,7 @@ class ImportExportController extends ControllerBehavior
$widgetConfig->alias = $type.'OptionsForm';
$widgetConfig->arrayName = ucfirst($type).'Options';
$widget = $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
return $widget;
return $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
}
return null;

View File

@ -903,8 +903,7 @@ class RelationController extends ControllerBehavior
$config->model->setRelation('pivot', $pivotModel);
}
$widget = $this->makeWidget('Backend\Widgets\Form', $config);
return $widget;
return $this->makeWidget('Backend\Widgets\Form', $config);
}
//

View File

@ -131,9 +131,7 @@ class BrandSetting extends Model
self::get('custom_css')
);
$css = $parser->getCss();
return $css;
return $parser->getCss();
}
//

View File

@ -182,8 +182,6 @@ class EditorSetting extends Model
$parser->parse($customStyles);
$css = $parser->getCss();
return $css;
return $parser->getCss();
}
}

View File

@ -947,8 +947,7 @@ class Form extends WidgetBase
}
if ($field->type === 'widget') {
$widget = $this->makeFormFieldWidget($field);
return $widget->showLabels;
return $this->makeFormFieldWidget($field)->showLabels;
}
return true;

View File

@ -683,9 +683,7 @@ class MediaManager extends WidgetBase
protected function getCurrentFolder()
{
$folder = $this->getSession('media_folder', self::FOLDER_ROOT);
return $folder;
return $this->getSession('media_folder', self::FOLDER_ROOT);
}
protected function setFilter($filter)
@ -899,9 +897,7 @@ class MediaManager extends WidgetBase
$partition = implode('/', array_slice(str_split($itemSignature, 3), 0, 3)) . '/';
$result = $this->getThumbnailDirectory().$partition.$thumbFile;
return $result;
return $this->getThumbnailDirectory().$partition.$thumbFile;
}
protected function getThumbnailImageUrl($imagePath)

View File

@ -448,8 +448,7 @@ class Theme
public function __get($name)
{
if ($this->hasCustomData()) {
$theme = $this->getCustomData();
return $theme->{$name};
return $this->getCustomData()->{$name};
}
return null;

View File

@ -427,9 +427,7 @@ class Index extends Controller
$widgetConfig->model = $template;
$widgetConfig->alias = $alias ?: 'form'.studly_case($type).md5($template->getFileName()).uniqid();
$widget = $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
return $widget;
return $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
}
protected function upgradeSettings($settings)

View File

@ -131,8 +131,7 @@ class ThemeOptions extends Controller
protected function getThemeData($dirName)
{
$theme = $this->findThemeObject($dirName);
$model = ThemeData::forTheme($theme);
return $model;
return ThemeData::forTheme($theme);
}
protected function findThemeObject($name = null)

View File

@ -115,8 +115,7 @@ class Themes extends Controller
$widgetConfig->arrayName = 'Theme';
$widgetConfig->context = 'update';
$widget = $this->makeWidget(Form::class, $widgetConfig);
return $widget;
return $this->makeWidget(Form::class, $widgetConfig);
}
//
@ -173,8 +172,7 @@ class Themes extends Controller
$widgetConfig->arrayName = 'Theme';
$widgetConfig->context = 'create';
$widget = $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
return $widget;
return $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
}
//
@ -256,8 +254,7 @@ class Themes extends Controller
$widgetConfig->model->theme = $theme;
$widgetConfig->arrayName = 'ThemeExport';
$widget = $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
return $widget;
return $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
}
//
@ -293,8 +290,7 @@ class Themes extends Controller
$widgetConfig->model->theme = $theme;
$widgetConfig->arrayName = 'ThemeImport';
$widget = $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
return $widget;
return $this->makeWidget('Backend\Widgets\Form', $widgetConfig);
}
//

View File

@ -246,8 +246,7 @@ class VersionManager
return self::NO_VERSION_VALUE;
}
$latest = trim(key(array_slice($versionInfo, -1, 1)));
return $latest;
return trim(key(array_slice($versionInfo, -1, 1)));
}
/**

View File

@ -165,8 +165,7 @@ class Settings extends Controller
}
$class = $item->class;
$model = $class::instance();
return $model;
return $class::instance();
}
/**

View File

@ -130,8 +130,7 @@ class DateTime
$replacements['\\'.$from] = '['.$from.']';
}
$momentFormat = strtr($format, $replacements);
return $momentFormat;
return strtr($format, $replacements);
}
}

View File

@ -154,8 +154,6 @@ class MailBrandSetting extends Model
$parser->parse(FileHelper::get($basePath . '/custom.less'));
$css = $parser->getCss();
return $css;
return $parser->getCss();
}
}

View File

@ -182,8 +182,7 @@ trait ConfigMaker
{
$classFolder = strtolower(class_basename($class));
$classFile = realpath(dirname(File::fromClass($class)));
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return $guessedPath;
return $classFile ? $classFile . '/' . $classFolder . $suffix : null;
}
/**