Completed
Push — master ( f1f202...f49b06 )
by Iman
01:39
created
src/helpers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists('render_widget')) {
3
+if (!function_exists('render_widget')) {
4 4
     function render_widget($widget, ...$args)
5 5
     {
6 6
         return app(\Imanghafoori\Widgets\Utils\WidgetRenderer::class)->renderWidget($widget, ...$args);
7 7
     }
8 8
 }
9 9
 
10
-if (! function_exists('expire_widgets')) {
10
+if (!function_exists('expire_widgets')) {
11 11
     function expire_widgets($tags)
12 12
     {
13 13
         return app(\Imanghafoori\Widgets\Utils\Cache::class)->expireTaggedWidgets($tags);
14 14
     }
15 15
 }
16 16
 
17
-if (! function_exists('json_widget')) {
17
+if (!function_exists('json_widget')) {
18 18
     function json_widget($widget, ...$args)
19 19
     {
20 20
         return app(\Imanghafoori\Widgets\Utils\WidgetJsonifier::class)->jsonResponse($widget, ...$args);
Please login to merge, or discard this patch.
src/Utils/WidgetJsonifier.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/Utils/Normalizer.php 1 patch
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 
5 5
 use Imanghafoori\Widgets\Utils\Normalizers\CacheNormalizer;
6 6
 use Imanghafoori\Widgets\Utils\Normalizers\ContextAsNormalizer;
7
-use Imanghafoori\Widgets\Utils\Normalizers\TemplateNormalizer;
8
-use Imanghafoori\Widgets\Utils\Normalizers\PresenterNormalizer;
9 7
 use Imanghafoori\Widgets\Utils\Normalizers\ControllerNormalizer;
8
+use Imanghafoori\Widgets\Utils\Normalizers\PresenterNormalizer;
9
+use Imanghafoori\Widgets\Utils\Normalizers\TemplateNormalizer;
10 10
 
11 11
 class Normalizer
12 12
 {
Please login to merge, or discard this patch.
src/Utils/Normalizers/ContextAsNormalizer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
         $contextAs = 'data';
61 61
         if (property_exists($widget, 'contextAs')) {
62 62
             // removes the $ sign.
63
-            $contextAs = str_replace('$', '', (string) $widget->contextAs);
63
+            $contextAs = str_replace('$', '', (string)$widget->contextAs);
64 64
         }
65 65
         $widget->contextAs = $contextAs;
66 66
     }
Please login to merge, or discard this patch.
src/WidgetsServiceProvider.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
     public function boot()
23 23
     {
24 24
         $this->publishes([
25
-            __DIR__.'/config/config.php' => config_path('widgetize.php'),
25
+            __DIR__ . '/config/config.php' => config_path('widgetize.php'),
26 26
         ]);
27 27
 
28 28
         $this->_defineDirectives();
29
-        $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets');
29
+        $this->loadViewsFrom($this->app->basePath() . '/app/Widgets/', 'Widgets');
30 30
     }
31 31
 
32 32
     /**
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
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}; ?>";
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function register()
52 52
     {
53
-        $this->mergeConfigFrom(__DIR__.'/config/config.php', 'widgetize');
53
+        $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'widgetize');
54 54
         $this->commands('command.imanghafoori.widget');
55 55
         $this->_registerSingletons();
56 56
         $this->_registerMacros();
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
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();
@@ -75,55 +75,55 @@  discard block
 block discarded – undo
75 75
             return new Utils\Normalizer($tplNormalizer, $cacheNormalizer, $presenterNormalizer, $ctrlNormalizer, $contextAsNormalizer);
76 76
         });
77 77
 
78
-        $this->app->singleton(Utils\HtmlMinifier::class, function () {
78
+        $this->app->singleton(Utils\HtmlMinifier::class, function() {
79 79
             return new Utils\HtmlMinifier();
80 80
         });
81 81
 
82
-        $this->app->singleton(Utils\DebugInfo::class, function () {
82
+        $this->app->singleton(Utils\DebugInfo::class, function() {
83 83
             return new Utils\DebugInfo();
84 84
         });
85 85
 
86
-        $this->app->singleton(Utils\Policies::class, function () {
86
+        $this->app->singleton(Utils\Policies::class, function() {
87 87
             return new Utils\Policies();
88 88
         });
89 89
 
90
-        $this->app->singleton(Utils\Cache::class, function () {
90
+        $this->app->singleton(Utils\Cache::class, function() {
91 91
             return new Utils\Cache();
92 92
         });
93 93
 
94
-        $this->app->singleton(Utils\CacheTag::class, function () {
94
+        $this->app->singleton(Utils\CacheTag::class, function() {
95 95
             return new Utils\CacheTag();
96 96
         });
97 97
 
98
-        $this->app->singleton(Utils\WidgetRenderer::class, function () {
98
+        $this->app->singleton(Utils\WidgetRenderer::class, function() {
99 99
             return new Utils\WidgetRenderer();
100 100
         });
101 101
     }
102 102
 
103 103
     private function _registerMacros()
104 104
     {
105
-        Route::macro('view', function ($url, $view, $name = null) {
105
+        Route::macro('view', function($url, $view, $name = null) {
106 106
             return Route::get($url, [
107 107
                 'as' => $name,
108
-                'uses' => function () use ($view) {
108
+                'uses' => function() use ($view) {
109 109
                     return view($view);
110 110
                 },
111 111
             ]);
112 112
         });
113 113
 
114
-        Route::macro('widget', function ($url, $widget, $name = null) {
114
+        Route::macro('widget', function($url, $widget, $name = null) {
115 115
             return Route::get($url, [
116 116
                 'as' => $name,
117
-                'uses' => function (...$args) use ($widget) {
117
+                'uses' => function(...$args) use ($widget) {
118 118
                     return render_widget($widget, $args);
119 119
                 },
120 120
             ]);
121 121
         });
122 122
 
123
-        Route::macro('jsonWidget', function ($url, $widget, $name = null) {
123
+        Route::macro('jsonWidget', function($url, $widget, $name = null) {
124 124
             return Route::get($url, [
125 125
                 'as' => $name,
126
-                'uses' => function (...$args) use ($widget) {
126
+                'uses' => function(...$args) use ($widget) {
127 127
                     return json_widget($widget, $args);
128 128
                 },
129 129
             ]);
Please login to merge, or discard this patch.