@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @param $app |
20 | 20 | */ |
21 | - private $singletonClasses = [ |
|
21 | + private $singletonClasses = [ |
|
22 | 22 | Utils\HtmlMinifier::class, |
23 | 23 | Utils\DebugInfo::class, |
24 | 24 | Utils\Policies::class, |
@@ -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 | } |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | |
40 | 40 | public function registerSingletons(Container $app) |
41 | 41 | { |
42 | - $app->singleton('command.imanghafoori.widget', function (Container $app) { |
|
42 | + $app->singleton('command.imanghafoori.widget', function(Container $app) { |
|
43 | 43 | return $app['Imanghafoori\Widgets\WidgetGenerator']; |
44 | 44 | }); |
45 | 45 | |
46 | - $app->singleton(Normalizer::class, function () { |
|
46 | + $app->singleton(Normalizer::class, function() { |
|
47 | 47 | $cacheNormalizer = new CacheNormalizer(); |
48 | 48 | $tplNormalizer = new TemplateNormalizer(); |
49 | 49 | $presenterNormalizer = new PresenterNormalizer(); |
@@ -24,6 +24,6 @@ |
||
24 | 24 | */ |
25 | 25 | public function render() |
26 | 26 | { |
27 | - return ; |
|
27 | + return; |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | private function persistToken(string $tag, string $token): void |
65 | 65 | { |
66 | - \Cache::forever('9z10_o6cg_r'.$tag, $token); |
|
66 | + \Cache::forever('9z10_o6cg_r' . $tag, $token); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -72,6 +72,6 @@ discard block |
||
72 | 72 | */ |
73 | 73 | private function getPersistedToken(string $tag): ?string |
74 | 74 | { |
75 | - return \Cache::get('9z10_o6cg_r'.$tag, null); |
|
75 | + return \Cache::get('9z10_o6cg_r' . $tag, null); |
|
76 | 76 | } |
77 | 77 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | private function makeWidgetObj(string $widget) |
36 | 36 | { |
37 | - $widget = app()->getNamespace().'Widgets\\'.$widget; |
|
37 | + $widget = app()->getNamespace() . 'Widgets\\' . $widget; |
|
38 | 38 | |
39 | 39 | return app($widget); |
40 | 40 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | private function generateJson($widget, ...$args) |
51 | 51 | { |
52 | 52 | // Everything inside this function is executed only when the cache is not available. |
53 | - $expensivePhpCode = function () use ($widget, $args) { |
|
53 | + $expensivePhpCode = function() use ($widget, $args) { |
|
54 | 54 | $data = \App::call($widget->controller, ...$args); |
55 | 55 | |
56 | 56 | // render the template with the resulting data. |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function widgetShouldUseCache(): bool |
25 | 25 | { |
26 | - return config('widgetize.enable_cache') && (! app()->environment('testing')); |
|
26 | + return config('widgetize.enable_cache') && (!app()->environment('testing')); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param string $html |
24 | 24 | * @return string |
25 | 25 | */ |
26 | - public function addIdentifierToHtml($widget,string $html): string |
|
26 | + public function addIdentifierToHtml($widget, string $html): string |
|
27 | 27 | { |
28 | 28 | $this->widget = $widget; |
29 | 29 | $this->html = $html; |
@@ -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 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - foreach ($this->normalizers as $normalizer){ |
|
61 | + foreach ($this->normalizers as $normalizer) { |
|
62 | 62 | $normalizer->normalize($widget); |
63 | 63 | } |
64 | 64 | $widget->isNormalized = true; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function normalizeJsonWidget($widget): void |
73 | 73 | { |
74 | - foreach ($this->normalizers as $normalizer){ |
|
74 | + foreach ($this->normalizers as $normalizer) { |
|
75 | 75 | $normalizer->normalize($widget); |
76 | 76 | } |
77 | 77 | } |
@@ -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) { |