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() protected function createModel()
{ {
$class = $this->config->modelClass; $class = $this->config->modelClass;
$model = new $class; return new $class;
return $model;
} }
/** /**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -182,8 +182,7 @@ trait ConfigMaker
{ {
$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; return $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return $guessedPath;
} }
/** /**