@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function normalize($widget) |
14 | 14 | { |
15 | - if (! property_exists($widget, 'cacheTags')) { |
|
15 | + if (!property_exists($widget, 'cacheTags')) { |
|
16 | 16 | return $widget->cacheTags = []; |
17 | 17 | } |
18 | 18 |
@@ -11,8 +11,8 @@ |
||
11 | 11 | */ |
12 | 12 | public function normalize($widget) |
13 | 13 | { |
14 | - if (! property_exists($widget, 'cacheLifeTime')) { |
|
15 | - $widget->cacheLifeTime = (int) (config('widgetize.default_cache_lifetime', 0)); |
|
14 | + if (!property_exists($widget, 'cacheLifeTime')) { |
|
15 | + $widget->cacheLifeTime = (int)(config('widgetize.default_cache_lifetime', 0)); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if ($widget->cacheLifeTime === 'forever' || $widget->cacheLifeTime < 0) { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | private function checkControllerExists(string $ctrlClass) |
26 | 26 | { |
27 | - if (! class_exists($ctrlClass)) { |
|
27 | + if (!class_exists($ctrlClass)) { |
|
28 | 28 | throw new \InvalidArgumentException("Controller class: [{$ctrlClass}] not found."); |
29 | 29 | } |
30 | 30 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | private function checkDataMethodExists(string $ctrlClass) |
36 | 36 | { |
37 | - if (! method_exists($ctrlClass, 'data')) { |
|
38 | - throw new \InvalidArgumentException("'data' method not found on ".$ctrlClass); |
|
37 | + if (!method_exists($ctrlClass, 'data')) { |
|
38 | + throw new \InvalidArgumentException("'data' method not found on " . $ctrlClass); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // then we decide to call data method on that instead. |
54 | 54 | if (property_exists($widget, 'controller')) { |
55 | 55 | $ctrlClass = $widget->controller; |
56 | - $controllerMethod = ($ctrlClass).'@data'; |
|
56 | + $controllerMethod = ($ctrlClass) . '@data'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return [$controllerMethod, $ctrlClass]; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $cache = app('cache'); |
32 | 32 | |
33 | - if (! empty($widgetObj->cacheTags) && $this->cacheDriverSupportsTags()) { |
|
33 | + if (!empty($widgetObj->cacheTags) && $this->cacheDriverSupportsTags()) { |
|
34 | 34 | $cache = $cache->tags($widgetObj->cacheTags); |
35 | 35 | } |
36 | 36 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | $_key = json_encode($widget->extraCacheKeyDependency($arg)); |
62 | 62 | } |
63 | 63 | |
64 | - if (! $this->cacheDriverSupportsTags()) { |
|
64 | + if (!$this->cacheDriverSupportsTags()) { |
|
65 | 65 | $_key .= json_encode($this->getTagTokens($widget->cacheTags)); |
66 | 66 | } |
67 | 67 | |
68 | - $_key .= json_encode($arg, JSON_FORCE_OBJECT).app()->getLocale().$form.$widget->template.get_class($widget); |
|
68 | + $_key .= json_encode($arg, JSON_FORCE_OBJECT) . app()->getLocale() . $form . $widget->template . get_class($widget); |
|
69 | 69 | |
70 | 70 | return md5($_key); |
71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function cacheDriverSupportsTags() : bool |
78 | 78 | { |
79 | - return ! in_array(config('cache.default', 'file'), ['file', 'database']); |
|
79 | + return !in_array(config('cache.default', 'file'), ['file', 'database']); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | private function getTagTokens(array $cacheTags) |
87 | 87 | { |
88 | - return array_map(function ($tag) { |
|
88 | + return array_map(function($tag) { |
|
89 | 89 | return $this->_cacheTag->getTagToken($tag); |
90 | 90 | }, $cacheTags); |
91 | 91 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | protected function declareAsSingleton(Container $app) |
31 | 31 | { |
32 | 32 | foreach ($this->singletonClasses as $class) { |
33 | - $app->singleton($class, function () use ($class) { |
|
33 | + $app->singleton($class, function() use ($class) { |
|
34 | 34 | return new $class; |
35 | 35 | }); |
36 | 36 | } |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | |
39 | 39 | public function registerSingletons(Container $app) |
40 | 40 | { |
41 | - $app->singleton('command.imanghafoori.widget', function (Container $app) { |
|
41 | + $app->singleton('command.imanghafoori.widget', function(Container $app) { |
|
42 | 42 | return $app['Imanghafoori\Widgets\WidgetGenerator']; |
43 | 43 | }); |
44 | 44 | |
45 | - $app->singleton(Normalizer::class, function () { |
|
45 | + $app->singleton(Normalizer::class, function() { |
|
46 | 46 | $cacheNormalizer = new CacheNormalizer(); |
47 | 47 | $tplNormalizer = new TemplateNormalizer(); |
48 | 48 | $presenterNormalizer = new PresenterNormalizer(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $tpl = $this->getTplPath($this->widget->template); |
42 | 42 | |
43 | - $this->html = "<span title='WidgetObj : ".get_class($this->widget).".php
Template : {$tpl}{$this->cacheState()}'>{$this->html}</span>"; |
|
43 | + $this->html = "<span title='WidgetObj : " . get_class($this->widget) . ".php
Template : {$tpl}{$this->cacheState()}'>{$this->html}</span>"; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | private function cacheState(): string |
52 | 52 | { |
53 | - if (! $this->policies->widgetShouldUseCache()) { |
|
53 | + if (!$this->policies->widgetShouldUseCache()) { |
|
54 | 54 | return ' 
Cache: is globally turned off (You should put "enable_cache" => true in config\widgetize.php) '; |
55 | 55 | } |
56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | private function addHtmlComments(): void |
61 | 61 | { |
62 | - $this->html = "<!-- '{".get_class($this->widget)."' Widget Start -->".$this->html."<!-- '".get_class($this->widget)."' Widget End -->"; |
|
62 | + $this->html = "<!-- '{" . get_class($this->widget) . "' Widget Start -->" . $this->html . "<!-- '" . get_class($this->widget) . "' Widget End -->"; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | private function getTplPath(string $tpl): string |
70 | 70 | { |
71 | 71 | if (str_contains($tpl, 'Widgets::')) { |
72 | - $tpl = str_replace('Widgets::', app()->getNamespace().'Widgets\\', $tpl); |
|
72 | + $tpl = str_replace('Widgets::', app()->getNamespace() . 'Widgets\\', $tpl); |
|
73 | 73 | } |
74 | 74 | |
75 | - return str_replace('.', '\\', $tpl).'.blade.php'; |
|
75 | + return str_replace('.', '\\', $tpl) . '.blade.php'; |
|
76 | 76 | } |
77 | 77 | } |