@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | private function makeWidgetObj($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. |
@@ -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() |
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() |
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($tpl) |
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 | } |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | { |
26 | 26 | $this->_registerDebugbar(); |
27 | 27 | $this->publishes([ |
28 | - __DIR__.'/config/config.php' => config_path('widgetize.php'), |
|
28 | + __DIR__ . '/config/config.php' => config_path('widgetize.php'), |
|
29 | 29 | ]); |
30 | 30 | |
31 | 31 | $this->defineDirectives(); |
32 | - $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets'); |
|
32 | + $this->loadViewsFrom($this->app->basePath() . '/app/Widgets/', 'Widgets'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $omitParenthesis = version_compare($this->app->version(), '5.3', '<'); |
41 | 41 | |
42 | - Blade::directive('widget', function ($expression) use ($omitParenthesis) { |
|
42 | + Blade::directive('widget', function($expression) use ($omitParenthesis) { |
|
43 | 43 | $expression = $omitParenthesis ? $expression : "($expression)"; |
44 | 44 | |
45 | 45 | return "<?php echo app(\\Imanghafoori\\Widgets\\Utils\\WidgetRenderer::class)->renderWidget{$expression}; ?>"; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function register() |
55 | 55 | { |
56 | - $this->mergeConfigFrom(__DIR__.'/config/config.php', 'widgetize'); |
|
56 | + $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'widgetize'); |
|
57 | 57 | $this->commands('command.imanghafoori.widget'); |
58 | 58 | $this->registerSingletons(); |
59 | 59 | $this->registerMacros(); |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private function registerSingletons() |
66 | 66 | { |
67 | - $this->app->singleton('command.imanghafoori.widget', function ($app) { |
|
67 | + $this->app->singleton('command.imanghafoori.widget', function($app) { |
|
68 | 68 | return $app['Imanghafoori\Widgets\WidgetGenerator']; |
69 | 69 | }); |
70 | 70 | |
71 | - $this->app->singleton(Normalizer::class, function () { |
|
71 | + $this->app->singleton(Normalizer::class, function() { |
|
72 | 72 | $cacheNormalizer = new CacheNormalizer(); |
73 | 73 | $tplNormalizer = new TemplateNormalizer(); |
74 | 74 | $presenterNormalizer = new PresenterNormalizer(); |
@@ -78,27 +78,27 @@ discard block |
||
78 | 78 | return new Utils\Normalizer($tplNormalizer, $cacheNormalizer, $presenterNormalizer, $ctrlNormalizer, $contextAsNormalizer); |
79 | 79 | }); |
80 | 80 | |
81 | - $this->app->singleton(Utils\HtmlMinifier::class, function () { |
|
81 | + $this->app->singleton(Utils\HtmlMinifier::class, function() { |
|
82 | 82 | return new Utils\HtmlMinifier(); |
83 | 83 | }); |
84 | 84 | |
85 | - $this->app->singleton(Utils\DebugInfo::class, function () { |
|
85 | + $this->app->singleton(Utils\DebugInfo::class, function() { |
|
86 | 86 | return new Utils\DebugInfo(); |
87 | 87 | }); |
88 | 88 | |
89 | - $this->app->singleton(Utils\Policies::class, function () { |
|
89 | + $this->app->singleton(Utils\Policies::class, function() { |
|
90 | 90 | return new Utils\Policies(); |
91 | 91 | }); |
92 | 92 | |
93 | - $this->app->singleton(Utils\Cache::class, function () { |
|
93 | + $this->app->singleton(Utils\Cache::class, function() { |
|
94 | 94 | return new Utils\Cache(); |
95 | 95 | }); |
96 | 96 | |
97 | - $this->app->singleton(Utils\CacheTag::class, function () { |
|
97 | + $this->app->singleton(Utils\CacheTag::class, function() { |
|
98 | 98 | return new Utils\CacheTag(); |
99 | 99 | }); |
100 | 100 | |
101 | - $this->app->singleton(Utils\WidgetRenderer::class, function () { |
|
101 | + $this->app->singleton(Utils\WidgetRenderer::class, function() { |
|
102 | 102 | return new Utils\WidgetRenderer(); |
103 | 103 | }); |
104 | 104 | } |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | |
111 | 111 | private function _registerDebugbar() |
112 | 112 | { |
113 | - if (! $this->app->offsetExists('debugbar')) { |
|
113 | + if (!$this->app->offsetExists('debugbar')) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - $this->app->singleton('widgetize.debugger', function () { |
|
117 | + $this->app->singleton('widgetize.debugger', function() { |
|
118 | 118 | return new MessagesCollector('Widgets'); |
119 | 119 | }); |
120 | 120 |