@@ -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 | } |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | private function registerViewMacro() |
| 19 | 19 | { |
| 20 | - Route::macro('view', function ($url, $view, $name = null) { |
|
| 20 | + Route::macro('view', function($url, $view, $name = null) { |
|
| 21 | 21 | return Route::get($url, [ |
| 22 | 22 | 'as' => $name, |
| 23 | - 'uses' => function () use ($view) { |
|
| 23 | + 'uses' => function() use ($view) { |
|
| 24 | 24 | return view($view); |
| 25 | 25 | }, |
| 26 | 26 | ]); |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | private function registerWidget() |
| 31 | 31 | { |
| 32 | - Route::macro('widget', function ($url, $widget, $name = null) { |
|
| 32 | + Route::macro('widget', function($url, $widget, $name = null) { |
|
| 33 | 33 | return Route::get($url, [ |
| 34 | 34 | 'as' => $name, |
| 35 | - 'uses' => function (...$args) use ($widget) { |
|
| 35 | + 'uses' => function(...$args) use ($widget) { |
|
| 36 | 36 | return render_widget($widget, $args); |
| 37 | 37 | }, |
| 38 | 38 | ]); |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | private function registerJsonWidget() |
| 43 | 43 | { |
| 44 | - Route::macro('jsonWidget', function ($url, $widget, $name = null) { |
|
| 44 | + Route::macro('jsonWidget', function($url, $widget, $name = null) { |
|
| 45 | 45 | return Route::get($url, [ |
| 46 | 46 | 'as' => $name, |
| 47 | - 'uses' => function (...$args) use ($widget) { |
|
| 47 | + 'uses' => function(...$args) use ($widget) { |
|
| 48 | 48 | return json_widget($widget, $args); |
| 49 | 49 | }, |
| 50 | 50 | ]); |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function registerSingletons($app) |
| 19 | 19 | { |
| 20 | - $app->singleton('command.imanghafoori.widget', function ($app) { |
|
| 20 | + $app->singleton('command.imanghafoori.widget', function($app) { |
|
| 21 | 21 | return $app['Imanghafoori\Widgets\WidgetGenerator']; |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | - $app->singleton(Normalizer::class, function () { |
|
| 24 | + $app->singleton(Normalizer::class, function() { |
|
| 25 | 25 | $cacheNormalizer = new CacheNormalizer(); |
| 26 | 26 | $tplNormalizer = new TemplateNormalizer(); |
| 27 | 27 | $presenterNormalizer = new PresenterNormalizer(); |
@@ -31,27 +31,27 @@ discard block |
||
| 31 | 31 | return new Utils\Normalizer($tplNormalizer, $cacheNormalizer, $presenterNormalizer, $ctrlNormalizer, $contextAsNormalizer); |
| 32 | 32 | }); |
| 33 | 33 | |
| 34 | - $app->singleton(Utils\HtmlMinifier::class, function () { |
|
| 34 | + $app->singleton(Utils\HtmlMinifier::class, function() { |
|
| 35 | 35 | return new Utils\HtmlMinifier(); |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | - $app->singleton(Utils\DebugInfo::class, function () { |
|
| 38 | + $app->singleton(Utils\DebugInfo::class, function() { |
|
| 39 | 39 | return new Utils\DebugInfo(); |
| 40 | 40 | }); |
| 41 | 41 | |
| 42 | - $app->singleton(Utils\Policies::class, function () { |
|
| 42 | + $app->singleton(Utils\Policies::class, function() { |
|
| 43 | 43 | return new Utils\Policies(); |
| 44 | 44 | }); |
| 45 | 45 | |
| 46 | - $app->singleton(Utils\Cache::class, function () { |
|
| 46 | + $app->singleton(Utils\Cache::class, function() { |
|
| 47 | 47 | return new Utils\Cache(); |
| 48 | 48 | }); |
| 49 | 49 | |
| 50 | - $app->singleton(Utils\CacheTag::class, function () { |
|
| 50 | + $app->singleton(Utils\CacheTag::class, function() { |
|
| 51 | 51 | return new Utils\CacheTag(); |
| 52 | 52 | }); |
| 53 | 53 | |
| 54 | - $app->singleton(Utils\WidgetRenderer::class, function () { |
|
| 54 | + $app->singleton(Utils\WidgetRenderer::class, function() { |
|
| 55 | 55 | return new Utils\WidgetRenderer(); |
| 56 | 56 | }); |
| 57 | 57 | } |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $this->_registerDebugbar(); |
| 19 | 19 | $this->publishes([ |
| 20 | - __DIR__.'/config/config.php' => config_path('widgetize.php'), |
|
| 20 | + __DIR__ . '/config/config.php' => config_path('widgetize.php'), |
|
| 21 | 21 | ]); |
| 22 | 22 | |
| 23 | 23 | $this->defineDirectives(); |
| 24 | - $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets'); |
|
| 24 | + $this->loadViewsFrom($this->app->basePath() . '/app/Widgets/', 'Widgets'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $omitParenthesis = version_compare($this->app->version(), '5.3', '<'); |
| 40 | 40 | |
| 41 | - Blade::directive('widget', function ($expression) use ($omitParenthesis) { |
|
| 41 | + Blade::directive('widget', function($expression) use ($omitParenthesis) { |
|
| 42 | 42 | $expression = $omitParenthesis ? $expression : "($expression)"; |
| 43 | 43 | |
| 44 | 44 | return "<?php echo app(\\Imanghafoori\\Widgets\\Utils\\WidgetRenderer::class)->renderWidget{$expression}; ?>"; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function register() |
| 54 | 54 | { |
| 55 | - $this->mergeConfigFrom(__DIR__.'/config/config.php', 'widgetize'); |
|
| 55 | + $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'widgetize'); |
|
| 56 | 56 | $this->commands('command.imanghafoori.widget'); |
| 57 | 57 | app(RouteMacros::class)->registerMacros(); |
| 58 | 58 | app(SingletonServices::class)->registerSingletons($this->app); |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | private function _registerDebugbar() |
| 62 | 62 | { |
| 63 | - if (! $this->app->offsetExists('debugbar')) { |
|
| 63 | + if (!$this->app->offsetExists('debugbar')) { |
|
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $this->app->singleton('widgetize.debugger', function () { |
|
| 67 | + $this->app->singleton('widgetize.debugger', function() { |
|
| 68 | 68 | return new MessagesCollector('Widgets'); |
| 69 | 69 | }); |
| 70 | 70 | |