@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | private function generateHtml(...$args) |
| 61 | 61 | { |
| 62 | 62 | // Everything inside this function is executed only when the cache is not available. |
| 63 | - $expensivePhpCode = function () use ($args) { |
|
| 63 | + $expensivePhpCode = function() use ($args) { |
|
| 64 | 64 | $this->prepareDataForView($args); |
| 65 | 65 | // render the template with the resulting data. |
| 66 | 66 | return $this->renderTemplate(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | // We first try to get the output from the cache before trying to run the expensive $expensivePhpCode... |
| 70 | 70 | if ($this->policies->widgetShouldUseCache($this->cacheLifeTime)) { |
| 71 | 71 | $key = $this->makeCacheKey($args); |
| 72 | - return app('imanghafoori.widget.cache')->cacheResult($key, $expensivePhpCode, $this->cacheLifeTime,$this->cacheTags); |
|
| 72 | + return app('imanghafoori.widget.cache')->cacheResult($key, $expensivePhpCode, $this->cacheLifeTime, $this->cacheTags); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return $expensivePhpCode(); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | /** |
| 9 | 9 | * @return bool |
| 10 | 10 | */ |
| 11 | - function widgetShouldHaveDebugInfo(){ |
|
| 11 | + function widgetShouldHaveDebugInfo() { |
|
| 12 | 12 | |
| 13 | 13 | return env('WIDGET_IDENTIFIER', true) and env('APP_ENV', 'production') === 'local'; |
| 14 | 14 | } |
@@ -7,28 +7,28 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class WidgetsServiceProvider extends ServiceProvider { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * Bootstrap any application services. |
|
| 12 | - * |
|
| 13 | - * @return void |
|
| 14 | - */ |
|
| 15 | - public function boot() |
|
| 16 | - { |
|
| 10 | + /** |
|
| 11 | + * Bootstrap any application services. |
|
| 12 | + * |
|
| 13 | + * @return void |
|
| 14 | + */ |
|
| 15 | + public function boot() |
|
| 16 | + { |
|
| 17 | 17 | \Blade::directive('include_widget', function ($expression) { |
| 18 | 18 | return "<?php echo $expression; ?>"; |
| 19 | 19 | }); |
| 20 | 20 | |
| 21 | 21 | $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets'); |
| 22 | - } |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * Register any application services. |
|
| 26 | - * |
|
| 27 | - * @return void |
|
| 28 | - */ |
|
| 29 | - public function register() |
|
| 30 | - { |
|
| 31 | - $this->app->singleton('command.imanghafoori.widget', function ($app) { |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * Register any application services. |
|
| 26 | + * |
|
| 27 | + * @return void |
|
| 28 | + */ |
|
| 29 | + public function register() |
|
| 30 | + { |
|
| 31 | + $this->app->singleton('command.imanghafoori.widget', function ($app) { |
|
| 32 | 32 | return $app['Imanghafoori\Widgets\WidgetGenerator']; |
| 33 | 33 | }); |
| 34 | 34 | |
@@ -53,6 +53,6 @@ discard block |
||
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | 55 | $this->commands('command.imanghafoori.widget'); |
| 56 | - } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | } |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public function boot() |
| 16 | 16 | { |
| 17 | - \Blade::directive('include_widget', function ($expression) { |
|
| 17 | + \Blade::directive('include_widget', function($expression) { |
|
| 18 | 18 | return "<?php echo $expression; ?>"; |
| 19 | 19 | }); |
| 20 | 20 | |
| 21 | - $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets'); |
|
| 21 | + $this->loadViewsFrom($this->app->basePath() . '/app/Widgets/', 'Widgets'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -28,27 +28,27 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function register() |
| 30 | 30 | { |
| 31 | - $this->app->singleton('command.imanghafoori.widget', function ($app) { |
|
| 31 | + $this->app->singleton('command.imanghafoori.widget', function($app) { |
|
| 32 | 32 | return $app['Imanghafoori\Widgets\WidgetGenerator']; |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | - $this->app->singleton('imanghafoori.widget.normalizer', function ($app) { |
|
| 35 | + $this->app->singleton('imanghafoori.widget.normalizer', function($app) { |
|
| 36 | 36 | return new Utils\Normalizer(); |
| 37 | 37 | }); |
| 38 | 38 | |
| 39 | - $this->app->singleton('imanghafoori.widget.minifier', function ($app) { |
|
| 39 | + $this->app->singleton('imanghafoori.widget.minifier', function($app) { |
|
| 40 | 40 | return new Utils\HtmlMinifier(); |
| 41 | 41 | }); |
| 42 | 42 | |
| 43 | - $this->app->singleton('imanghafoori.widget.debugInfo', function ($app) { |
|
| 43 | + $this->app->singleton('imanghafoori.widget.debugInfo', function($app) { |
|
| 44 | 44 | return new Utils\DebugInfo(); |
| 45 | 45 | }); |
| 46 | 46 | |
| 47 | - $this->app->singleton('imanghafoori.widget.policies', function ($app) { |
|
| 47 | + $this->app->singleton('imanghafoori.widget.policies', function($app) { |
|
| 48 | 48 | return new Utils\Policies(); |
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | - $this->app->singleton('imanghafoori.widget.cache', function ($app) { |
|
| 51 | + $this->app->singleton('imanghafoori.widget.cache', function($app) { |
|
| 52 | 52 | return new Utils\Cache(); |
| 53 | 53 | }); |
| 54 | 54 | |