@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | private function _generateJson($widget, ...$args) |
| 41 | 41 | { |
| 42 | 42 | // Everything inside this function is executed only when the cache is not available. |
| 43 | - $expensivePhpCode = function () use ($widget, $args) { |
|
| 43 | + $expensivePhpCode = function() use ($widget, $args) { |
|
| 44 | 44 | $data = \App::call($widget->controller, ...$args); |
| 45 | 45 | // render the template with the resulting data. |
| 46 | 46 | return response()->json($data, 200); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | private function _makeWidgetObj($widget) |
| 63 | 63 | { |
| 64 | - $widget = app()->getNamespace().'Widgets\\'.$widget; |
|
| 64 | + $widget = app()->getNamespace() . 'Widgets\\' . $widget; |
|
| 65 | 65 | return app($widget); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -15,8 +15,8 @@ |
||
| 15 | 15 | $presenter = $widget->presenter; |
| 16 | 16 | $this->checkPresenterExists($presenter); |
| 17 | 17 | } else { |
| 18 | - $presenter = get_class($widget).'Presenter'; |
|
| 19 | - if (! class_exists($presenter)) { |
|
| 18 | + $presenter = get_class($widget) . 'Presenter'; |
|
| 19 | + if (!class_exists($presenter)) { |
|
| 20 | 20 | return $widget->presenter = null; |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $omitParenthesis = version_compare($this->app->version(), '5.3', '<'); |
| 38 | 38 | |
| 39 | - Blade::directive('widget', function ($expression) use ($omitParenthesis) { |
|
| 39 | + Blade::directive('widget', function($expression) use ($omitParenthesis) { |
|
| 40 | 40 | $expression = $omitParenthesis ? $expression : "($expression)"; |
| 41 | 41 | |
| 42 | 42 | return "<?php echo app(\\Imanghafoori\\Widgets\\Utils\\WidgetRenderer::class)->renderWidget{$expression}; ?>"; |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | private function _registerSingletons() |
| 63 | 63 | { |
| 64 | - $this->app->singleton('command.imanghafoori.widget', function ($app) { |
|
| 64 | + $this->app->singleton('command.imanghafoori.widget', function($app) { |
|
| 65 | 65 | return $app['Imanghafoori\Widgets\WidgetGenerator']; |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | - $this->app->singleton(Normalizer::class, function () { |
|
| 68 | + $this->app->singleton(Normalizer::class, function() { |
|
| 69 | 69 | $cacheNormalizer = new CacheNormalizer(); |
| 70 | 70 | $tplNormalizer = new TemplateNormalizer(); |
| 71 | 71 | $presenterNormalizer = new PresenterNormalizer(); |
@@ -74,55 +74,55 @@ discard block |
||
| 74 | 74 | return new Utils\Normalizer($tplNormalizer, $cacheNormalizer, $presenterNormalizer, $ctrlNormalizer); |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | - $this->app->singleton(Utils\HtmlMinifier::class, function () { |
|
| 77 | + $this->app->singleton(Utils\HtmlMinifier::class, function() { |
|
| 78 | 78 | return new Utils\HtmlMinifier(); |
| 79 | 79 | }); |
| 80 | 80 | |
| 81 | - $this->app->singleton(Utils\DebugInfo::class, function () { |
|
| 81 | + $this->app->singleton(Utils\DebugInfo::class, function() { |
|
| 82 | 82 | return new Utils\DebugInfo(); |
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | - $this->app->singleton(Utils\Policies::class, function () { |
|
| 85 | + $this->app->singleton(Utils\Policies::class, function() { |
|
| 86 | 86 | return new Utils\Policies(); |
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | - $this->app->singleton(Utils\Cache::class, function () { |
|
| 89 | + $this->app->singleton(Utils\Cache::class, function() { |
|
| 90 | 90 | return new Utils\Cache(); |
| 91 | 91 | }); |
| 92 | 92 | |
| 93 | - $this->app->singleton(Utils\CacheTag::class, function () { |
|
| 93 | + $this->app->singleton(Utils\CacheTag::class, function() { |
|
| 94 | 94 | return new Utils\CacheTag(); |
| 95 | 95 | }); |
| 96 | 96 | |
| 97 | - $this->app->singleton(Utils\WidgetRenderer::class, function () { |
|
| 97 | + $this->app->singleton(Utils\WidgetRenderer::class, function() { |
|
| 98 | 98 | return new Utils\WidgetRenderer(); |
| 99 | 99 | }); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | private function _registerMacros() |
| 103 | 103 | { |
| 104 | - Route::macro('view', function ($url, $view, $name = null) { |
|
| 104 | + Route::macro('view', function($url, $view, $name = null) { |
|
| 105 | 105 | return Route::get($url, [ |
| 106 | 106 | 'as' => $name, |
| 107 | - 'uses' => function () use ($view) { |
|
| 107 | + 'uses' => function() use ($view) { |
|
| 108 | 108 | return view($view); |
| 109 | 109 | } |
| 110 | 110 | ]); |
| 111 | 111 | }); |
| 112 | 112 | |
| 113 | - Route::macro('widget', function ($url, $widget, $name = null) { |
|
| 113 | + Route::macro('widget', function($url, $widget, $name = null) { |
|
| 114 | 114 | return Route::get($url, [ |
| 115 | 115 | 'as' => $name, |
| 116 | - 'uses' => function (...$args) use ($widget) { |
|
| 116 | + 'uses' => function(...$args) use ($widget) { |
|
| 117 | 117 | return render_widget($widget, $args); |
| 118 | 118 | } |
| 119 | 119 | ]); |
| 120 | 120 | }); |
| 121 | 121 | |
| 122 | - Route::macro('jsonWidget', function ($url, $widget, $name = null) { |
|
| 122 | + Route::macro('jsonWidget', function($url, $widget, $name = null) { |
|
| 123 | 123 | return Route::get($url, [ |
| 124 | 124 | 'as' => $name, |
| 125 | - 'uses' => function (...$args) use ($widget) { |
|
| 125 | + 'uses' => function(...$args) use ($widget) { |
|
| 126 | 126 | return json_widget($widget, $args); |
| 127 | 127 | } |
| 128 | 128 | ]); |