Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed Mar 31, 2017
1 parent 750795a commit 684fa41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/Utils/Normalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

class Normalizer
{
private $widget;
private $presenterNormalizer;
private $templateNormalizer;
private $cacheNormalizer;
private $controllerNormalizer;

/**
* Normalizer constructor.
Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion src/WidgetsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function register()
$templateNormalizer = new TemplateNormalizer();
$presenterNormalizer = new PresenterNormalizer();
$controllerNormalizer = new ControllerNormalizer();

return new Utils\Normalizer($templateNormalizer, $cacheNormalizer, $presenterNormalizer, $controllerNormalizer);
});

Expand Down

0 comments on commit 684fa41

Please sign in to comment.