Completed
Push — master ( c5f471...ff15e9 )
by Iman
04:49 queued 03:14
created
src/WidgetsServiceProvider.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $this->_registerDebugbar();
26 26
         $this->publishes([
27
-            __DIR__.'/config/config.php' => config_path('widgetize.php'),
27
+            __DIR__ . '/config/config.php' => config_path('widgetize.php'),
28 28
         ]);
29 29
 
30 30
         $this->defineDirectives();
31
-        $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets');
31
+        $this->loadViewsFrom($this->app->basePath() . '/app/Widgets/', 'Widgets');
32 32
     }
33 33
 
34 34
     /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         $this->registerSingletons();
58 58
         $this->registerMacros();
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
      */
64 64
     private function registerSingletons()
65 65
     {
66
-        $this->app->singleton('command.imanghafoori.widget', function ($app) {
66
+        $this->app->singleton('command.imanghafoori.widget', function($app) {
67 67
             return $app['Imanghafoori\Widgets\WidgetGenerator'];
68 68
         });
69 69
 
70
-        $this->app->singleton(Normalizer::class, function () {
70
+        $this->app->singleton(Normalizer::class, function() {
71 71
             $cacheNormalizer = new CacheNormalizer();
72 72
             $tplNormalizer = new TemplateNormalizer();
73 73
             $presenterNormalizer = new PresenterNormalizer();
@@ -77,55 +77,55 @@  discard block
 block discarded – undo
77 77
             return new Utils\Normalizer($tplNormalizer, $cacheNormalizer, $presenterNormalizer, $ctrlNormalizer, $contextAsNormalizer);
78 78
         });
79 79
 
80
-        $this->app->singleton(Utils\HtmlMinifier::class, function () {
80
+        $this->app->singleton(Utils\HtmlMinifier::class, function() {
81 81
             return new Utils\HtmlMinifier();
82 82
         });
83 83
 
84
-        $this->app->singleton(Utils\DebugInfo::class, function () {
84
+        $this->app->singleton(Utils\DebugInfo::class, function() {
85 85
             return new Utils\DebugInfo();
86 86
         });
87 87
 
88
-        $this->app->singleton(Utils\Policies::class, function () {
88
+        $this->app->singleton(Utils\Policies::class, function() {
89 89
             return new Utils\Policies();
90 90
         });
91 91
 
92
-        $this->app->singleton(Utils\Cache::class, function () {
92
+        $this->app->singleton(Utils\Cache::class, function() {
93 93
             return new Utils\Cache();
94 94
         });
95 95
 
96
-        $this->app->singleton(Utils\CacheTag::class, function () {
96
+        $this->app->singleton(Utils\CacheTag::class, function() {
97 97
             return new Utils\CacheTag();
98 98
         });
99 99
 
100
-        $this->app->singleton(Utils\WidgetRenderer::class, function () {
100
+        $this->app->singleton(Utils\WidgetRenderer::class, function() {
101 101
             return new Utils\WidgetRenderer();
102 102
         });
103 103
     }
104 104
 
105 105
     private function registerMacros()
106 106
     {
107
-        Route::macro('view', function ($url, $view, $name = null) {
107
+        Route::macro('view', function($url, $view, $name = null) {
108 108
             return Route::get($url, [
109 109
                 'as' => $name,
110
-                'uses' => function () use ($view) {
110
+                'uses' => function() use ($view) {
111 111
                     return view($view);
112 112
                 },
113 113
             ]);
114 114
         });
115 115
 
116
-        Route::macro('widget', function ($url, $widget, $name = null) {
116
+        Route::macro('widget', function($url, $widget, $name = null) {
117 117
             return Route::get($url, [
118 118
                 'as' => $name,
119
-                'uses' => function (...$args) use ($widget) {
119
+                'uses' => function(...$args) use ($widget) {
120 120
                     return render_widget($widget, $args);
121 121
                 },
122 122
             ]);
123 123
         });
124 124
 
125
-        Route::macro('jsonWidget', function ($url, $widget, $name = null) {
125
+        Route::macro('jsonWidget', function($url, $widget, $name = null) {
126 126
             return Route::get($url, [
127 127
                 'as' => $name,
128
-                'uses' => function (...$args) use ($widget) {
128
+                'uses' => function(...$args) use ($widget) {
129 129
                     return json_widget($widget, $args);
130 130
                 },
131 131
             ]);
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 
135 135
     private function _registerDebugbar()
136 136
     {
137
-        if (! $this->app->offsetExists('debugbar')) {
137
+        if (!$this->app->offsetExists('debugbar')) {
138 138
             return;
139 139
         }
140
-        $this->app->singleton('widgetize.debugger', function () {
140
+        $this->app->singleton('widgetize.debugger', function() {
141 141
             return new MessagesCollector('Widgets');
142 142
         });
143 143
 
Please login to merge, or discard this patch.