Completed
Branch master (9fd700)
by Iman
05:17
created
src/BaseWidget.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -255,6 +255,10 @@
 block discarded – undo
255 255
         return ((env('WIDGET_CACHE', false) !== false) and (!app()->environment('testing')) and ($this->cacheLifeTime !== 0));
256 256
     }
257 257
 
258
+    /**
259
+     * @param string $key
260
+     * @param \Closure $phpCode
261
+     */
258 262
     private function cacheResult($key, $phpCode)
259 263
     {
260 264
         $cache = app()->make('cache');
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
             $presenter = get_called_class() . 'Presenter';
61 61
 
62 62
             if (class_exists($presenter)) {
63
-                $this->presenter = $presenter.'@presenter';
64
-            }else{
63
+                $this->presenter = $presenter . '@presenter';
64
+            } else {
65 65
                 $this->presenter = null;
66 66
             }
67 67
         } else {
68 68
             if (class_exists($this->presenter) === false) {
69 69
                 throw new \InvalidArgumentException("Presenter Class [{$this->presenter}] not found.");
70 70
             }
71
-            $this->presenter = $this->presenter.'@present';
71
+            $this->presenter = $this->presenter . '@present';
72 72
         }
73 73
 
74 74
     }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     private function generateHtml(...$args)
143 143
     {
144 144
         // Everything inside this function is executed only when the cache is not available.
145
-        $expensivePhpCode = function () use ($args) {
145
+        $expensivePhpCode = function() use ($args) {
146 146
             $this->prepareDataForView($args);
147 147
 
148 148
             // render the template with the resulting data.
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
         // We add some HTML comments before and after the widget output
191 191
         // So then, we will be able to easily identify the widget in browser's developer tool.
192
-        if (env('WIDGET_IDENTIFIER', true) and env('APP_ENV','production') === 'local') {
192
+        if (env('WIDGET_IDENTIFIER', true) and env('APP_ENV', 'production') === 'local') {
193 193
             $this->addIdentifierToHtml();
194 194
         }
195 195
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     private function addIdentifierToHtml()
227 227
     {
228 228
         $name = $this->friendlyName;
229
-        $this->html = "<div title='". get_called_class() . "::class || template : {$this->template}".$this->cacheState()."style='box-shadow: 0px 0px 15px 5px #00c62b inset'>" . $this->html ."</div>";
229
+        $this->html = "<div title='" . get_called_class() . "::class || template : {$this->template}" . $this->cacheState() . "style='box-shadow: 0px 0px 15px 5px #00c62b inset'>" . $this->html . "</div>";
230 230
         $this->html = "<!-- '$name' Widget Start -->" . $this->html . "<!-- '$name' Widget End -->";
231 231
     }
232 232
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     {
260 260
         $cache = app()->make('cache');
261 261
 
262
-        if($this->cacheTags){
262
+        if ($this->cacheTags) {
263 263
             $cache = $cache->tags($this->cacheTags);
264 264
         }
265 265
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      */
287 287
     private function cacheShouldBeTagged()
288 288
     {
289
-        return !in_array(env('CACHE_DRIVER','file'), ['file', 'database']) and $this->cacheTags;
289
+        return !in_array(env('CACHE_DRIVER', 'file'), ['file', 'database']) and $this->cacheTags;
290 290
     }
291 291
 
292 292
     /**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      */
295 295
     private function cacheState()
296 296
     {
297
-        if($this->widgetShouldUseCache()){
297
+        if ($this->widgetShouldUseCache()) {
298 298
             return " || cache: {$this->cacheLifeTime}(min)' ";
299 299
         }
300 300
         return  " || cache : off";
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 
62 62
             if (class_exists($presenter)) {
63 63
                 $this->presenter = $presenter.'@presenter';
64
-            }else{
64
+            } else{
65 65
                 $this->presenter = null;
66 66
             }
67 67
         } else {
Please login to merge, or discard this patch.
src/WidgetGenerator.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 class WidgetGenerator extends LaravelGeneratorCommand 
8 8
 {
9
-	/**
9
+    /**
10 10
      * The name and signature of the console command.
11 11
      *
12 12
      * @var string
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     protected function getStub()
36 36
     {
37 37
        
38
-		return __DIR__.'/../stubs/widget.stub';
38
+        return __DIR__.'/../stubs/widget.stub';
39 39
        
40 40
     }
41 41
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     protected function getStub()
36 36
     {
37 37
        
38
-		return __DIR__.'/../stubs/widget.stub';
38
+		return __DIR__ . '/../stubs/widget.stub';
39 39
        
40 40
     }
41 41
 
Please login to merge, or discard this patch.
src/WidgetsServiceProvider.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -7,32 +7,32 @@
 block discarded – undo
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
         $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets');
18
-	}
18
+    }
19 19
 
20
-	/**
21
-	 * Register any application services.
22
-	 *
23
-	 * This service provider is a great spot to register your various container
24
-	 * bindings with the application. As you can see, we are registering our
25
-	 * "Registrar" implementation here. You can add your own bindings too!
26
-	 *
27
-	 * @return void
28
-	 */
29
-	public function register()
30
-	{
31
-		$this->app->singleton('command.imanghafoori.widget', function ($app) {
20
+    /**
21
+     * Register any application services.
22
+     *
23
+     * This service provider is a great spot to register your various container
24
+     * bindings with the application. As you can see, we are registering our
25
+     * "Registrar" implementation here. You can add your own bindings too!
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
 		
35 35
         $this->commands('command.imanghafoori.widget');
36
-	}
36
+    }
37 37
 
38 38
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	 */
15 15
 	public function boot()
16 16
 	{
17
-        $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets');
17
+        $this->loadViewsFrom($this->app->basePath() . '/app/Widgets/', 'Widgets');
18 18
 	}
19 19
 
20 20
 	/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
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
 		
Please login to merge, or discard this patch.