Completed
Push — master ( 5e7297...b76511 )
by Iman
14:15
created
src/Utils/WidgetRenderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     private function _generateHtml($widget, ...$args)
46 46
     {
47 47
         // Everything inside this function is executed only when the cache is not available.
48
-        $expensivePhpCode = function () use ($widget, $args) {
48
+        $expensivePhpCode = function() use ($widget, $args) {
49 49
             $this->_makeDataForView($widget, $args);
50 50
             // render the template with the resulting data.
51 51
             return $this->renderTemplate($widget);
Please login to merge, or discard this patch.
src/WidgetGenerator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     protected function getStub()
36 36
     {
37
-        return __DIR__.'/../stubs/widget.stub';
37
+        return __DIR__ . '/../stubs/widget.stub';
38 38
     }
39 39
 
40 40
     /**
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 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);
Please login to merge, or discard this patch.
src/WidgetsServiceProvider.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function boot()
20 20
     {
21
-        \Blade::directive('include_widget', function ($expression) {
21
+        \Blade::directive('include_widget', function($expression) {
22 22
             return "<?php echo $expression; ?>";
23 23
         });
24 24
 
25
-        $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets');
25
+        $this->loadViewsFrom($this->app->basePath() . '/app/Widgets/', 'Widgets');
26 26
     }
27 27
 
28 28
     /**
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function register()
34 34
     {
35
-        $this->app->singleton('command.imanghafoori.widget', function ($app) {
35
+        $this->app->singleton('command.imanghafoori.widget', function($app) {
36 36
             return $app['Imanghafoori\Widgets\WidgetGenerator'];
37 37
         });
38 38
 
39
-        $this->app->singleton(Normalizer::class, function () {
39
+        $this->app->singleton(Normalizer::class, function() {
40 40
             $cacheNormalizer = new CacheNormalizer();
41 41
             $templateNormalizer = new TemplateNormalizer();
42 42
             $presenterNormalizer = new PresenterNormalizer();
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
             return new Utils\Normalizer($templateNormalizer, $cacheNormalizer, $presenterNormalizer, $controllerNormalizer);
46 46
         });
47 47
 
48
-        $this->app->singleton(Utils\HtmlMinifier::class, function () {
48
+        $this->app->singleton(Utils\HtmlMinifier::class, function() {
49 49
             return new Utils\HtmlMinifier();
50 50
         });
51 51
 
52
-        $this->app->singleton(Utils\DebugInfo::class, function () {
52
+        $this->app->singleton(Utils\DebugInfo::class, function() {
53 53
             return new Utils\DebugInfo();
54 54
         });
55 55
 
56
-        $this->app->singleton(Utils\Policies::class, function () {
56
+        $this->app->singleton(Utils\Policies::class, function() {
57 57
             return new Utils\Policies();
58 58
         });
59 59
 
60
-        $this->app->singleton(Utils\Cache::class, function () {
60
+        $this->app->singleton(Utils\Cache::class, function() {
61 61
             return new Utils\Cache();
62 62
         });
63 63
 
64
-        $this->app->singleton(Utils\WidgetRenderer::class, function () {
64
+        $this->app->singleton(Utils\WidgetRenderer::class, function() {
65 65
             return new Utils\WidgetRenderer();
66 66
         });
67 67
 
Please login to merge, or discard this patch.
src/Utils/Normalizers/ControllerNormalizer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         // then we decide to call data method on that instead.
20 20
         if (property_exists($widget, 'controller')) {
21 21
             $ctrlClass = $widget->controller;
22
-            $controllerMethod = ($ctrlClass).'@data';
22
+            $controllerMethod = ($ctrlClass) . '@data';
23 23
         }
24 24
 
25 25
         $this->checkControllerExists($ctrlClass);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     private function checkControllerExists($ctrlClass)
35 35
     {
36
-        if (! class_exists($ctrlClass)) {
36
+        if (!class_exists($ctrlClass)) {
37 37
             throw new \InvalidArgumentException("Controller class: [{$ctrlClass}] not found.");
38 38
         }
39 39
     }
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
      */
44 44
     private function checkDataMethodExists($ctrlClass)
45 45
     {
46
-        if (! method_exists($ctrlClass, 'data')) {
47
-            throw new \InvalidArgumentException("'data' method not found on ".$ctrlClass);
46
+        if (!method_exists($ctrlClass, 'data')) {
47
+            throw new \InvalidArgumentException("'data' method not found on " . $ctrlClass);
48 48
         }
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
src/Utils/Normalizers/CacheNormalizer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function normalizeCacheLifeTime($widget)
13 13
     {
14
-        if (! property_exists($widget, 'cacheLifeTime')) {
15
-            $widget->cacheLifeTime = (int) (env('WIDGET_DEFAULT_CACHE_LIFETIME', 0));
14
+        if (!property_exists($widget, 'cacheLifeTime')) {
15
+            $widget->cacheLifeTime = (int)(env('WIDGET_DEFAULT_CACHE_LIFETIME', 0));
16 16
         }
17 17
 
18 18
         if ($widget->cacheLifeTime === 'forever') {
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function normalizeCacheTags($widget)
29 29
     {
30
-        if (! $this->cacheCanUseTags() || ! property_exists($widget, 'cacheTags')) {
30
+        if (!$this->cacheCanUseTags() || !property_exists($widget, 'cacheTags')) {
31 31
             return $widget->cacheTags = null;
32 32
         }
33 33
 
@@ -44,6 +44,6 @@  discard block
 block discarded – undo
44 44
      */
45 45
     private function cacheCanUseTags()
46 46
     {
47
-        return ! in_array(env('CACHE_DRIVER', 'file'), ['file', 'database']);
47
+        return !in_array(env('CACHE_DRIVER', 'file'), ['file', 'database']);
48 48
     }
49 49
 }
Please login to merge, or discard this patch.
src/Utils/Normalizers/PresenterNormalizer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
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
         }
23 23
 
24 24
         $this->checkPresentMethodExists($presenter);
25 25
 
26
-        $widget->presenter = $presenter.'@present';
26
+        $widget->presenter = $presenter . '@present';
27 27
     }
28 28
 
29 29
     /**
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
      */
32 32
     private function checkPresentMethodExists($presenter)
33 33
     {
34
-        if (! method_exists($presenter, 'present')) {
35
-            throw new \InvalidArgumentException("'present' method not found on : ".$presenter);
34
+        if (!method_exists($presenter, 'present')) {
35
+            throw new \InvalidArgumentException("'present' method not found on : " . $presenter);
36 36
         }
37 37
     }
38 38
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     private function checkPresenterExists($presenter)
43 43
     {
44
-        if (! class_exists($presenter)) {
44
+        if (!class_exists($presenter)) {
45 45
             throw new \InvalidArgumentException("Presenter Class [{$presenter}] not found.");
46 46
         }
47 47
     }
Please login to merge, or discard this patch.
src/Utils/Normalizers/TemplateNormalizer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@
 block discarded – undo
17 17
         // replace slashes with dots
18 18
         $className = str_replace(['\\', '/'], '.', $className);
19 19
 
20
-        if (! property_exists($widget, 'template')) {
21
-            $widget->template = 'Widgets::'.$className.'View';
20
+        if (!property_exists($widget, 'template')) {
21
+            $widget->template = 'Widgets::' . $className . 'View';
22 22
         }
23 23
 
24
-        if (! view()->exists($widget->template)) {
25
-            throw new \InvalidArgumentException("View file [{$className}View] not found by: '".class_basename($widget)." '");
24
+        if (!view()->exists($widget->template)) {
25
+            throw new \InvalidArgumentException("View file [{$className}View] not found by: '" . class_basename($widget) . " '");
26 26
         }
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Utils/Cache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,6 +46,6 @@
 block discarded – undo
46 46
      */
47 47
     private function _makeCacheKey($arg, $widget)
48 48
     {
49
-        return md5(json_encode($arg, JSON_FORCE_OBJECT).$widget->template.class_basename($widget));
49
+        return md5(json_encode($arg, JSON_FORCE_OBJECT) . $widget->template . class_basename($widget));
50 50
     }
51 51
 }
Please login to merge, or discard this patch.