diff --git a/src/Utils/Normalizer.php b/src/Utils/Normalizer.php index fc7d673..e15d884 100644 --- a/src/Utils/Normalizer.php +++ b/src/Utils/Normalizer.php @@ -10,9 +10,10 @@ class Normalizer { - private $widget; private $presenterNormalizer; private $templateNormalizer; + private $cacheNormalizer; + private $controllerNormalizer; /** * Normalizer constructor. @@ -38,23 +39,23 @@ public function normalizeWidgetConfig(BaseWidget $widget) return null; } - $this->widget = $widget; $this->controllerNormalizer->normalizeControllerMethod($widget); $this->presenterNormalizer->normalizePresenterName($widget); $this->templateNormalizer->normalizeTemplateName($widget); $this->cacheNormalizer->normalizeCacheLifeTime($widget); $this->cacheNormalizer->normalizeCacheTags($widget); - $this->normalizeContextAs(); + $this->normalizeContextAs($widget); $widget->isNormalized = true; } /** * Figures out what the variable name should be in view file. + * @param $widget * @return null */ - private function normalizeContextAs() + private function normalizeContextAs($widget) { // removes the $ sign. - $this->widget->contextAs = str_replace('$', '', (string)$this->widget->contextAs); + $widget->contextAs = str_replace('$', '', (string)$widget->contextAs); } } diff --git a/src/WidgetsServiceProvider.php b/src/WidgetsServiceProvider.php index 860e812..eda203e 100644 --- a/src/WidgetsServiceProvider.php +++ b/src/WidgetsServiceProvider.php @@ -42,7 +42,7 @@ public function register() $templateNormalizer = new TemplateNormalizer(); $presenterNormalizer = new PresenterNormalizer(); $controllerNormalizer = new ControllerNormalizer(); - + return new Utils\Normalizer($templateNormalizer, $cacheNormalizer, $presenterNormalizer, $controllerNormalizer); });