Completed
Push — master ( e051f1...7eb81a )
by Iman
03:49 queued 01:42
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/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/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/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.
src/Utils/Normalizer.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/Utils/Policies.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function widgetShouldUseCache()
25 25
     {
26
-        return (env('WIDGET_CACHE', false) !== false) && (! app()->environment('testing'));
26
+        return (env('WIDGET_CACHE', false) !== false) && (!app()->environment('testing'));
27 27
     }
28 28
 
29 29
     /**
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
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
     {
22 22
         $omitParenthesis = version_compare($this->app->version(), '5.3', '<');
23 23
 
24
-        Blade::directive('render_widget', function ($expression) use ($omitParenthesis) {
24
+        Blade::directive('render_widget', function($expression) use ($omitParenthesis) {
25 25
             $expression = $omitParenthesis ? $expression : "($expression)";
26 26
 
27 27
             return "<?php echo app(\\Imanghafoori\\Widgets\\Utils\\WidgetRenderer::class)->renderWidget{$expression}; ?>";
28 28
         });
29 29
 
30
-        $this->loadViewsFrom($this->app->basePath().'/app/Widgets/', 'Widgets');
30
+        $this->loadViewsFrom($this->app->basePath() . '/app/Widgets/', 'Widgets');
31 31
     }
32 32
 
33 33
     /**
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function register()
39 39
     {
40
-        $this->app->singleton('command.imanghafoori.widget', function ($app) {
40
+        $this->app->singleton('command.imanghafoori.widget', function($app) {
41 41
             return $app['Imanghafoori\Widgets\WidgetGenerator'];
42 42
         });
43 43
 
44
-        $this->app->singleton(Normalizer::class, function () {
44
+        $this->app->singleton(Normalizer::class, function() {
45 45
             $cacheNormalizer = new CacheNormalizer();
46 46
             $templateNormalizer = new TemplateNormalizer();
47 47
             $presenterNormalizer = new PresenterNormalizer();
@@ -50,23 +50,23 @@  discard block
 block discarded – undo
50 50
             return new Utils\Normalizer($templateNormalizer, $cacheNormalizer, $presenterNormalizer, $controllerNormalizer);
51 51
         });
52 52
 
53
-        $this->app->singleton(Utils\HtmlMinifier::class, function () {
53
+        $this->app->singleton(Utils\HtmlMinifier::class, function() {
54 54
             return new Utils\HtmlMinifier();
55 55
         });
56 56
 
57
-        $this->app->singleton(Utils\DebugInfo::class, function () {
57
+        $this->app->singleton(Utils\DebugInfo::class, function() {
58 58
             return new Utils\DebugInfo();
59 59
         });
60 60
 
61
-        $this->app->singleton(Utils\Policies::class, function () {
61
+        $this->app->singleton(Utils\Policies::class, function() {
62 62
             return new Utils\Policies();
63 63
         });
64 64
 
65
-        $this->app->singleton(Utils\Cache::class, function () {
65
+        $this->app->singleton(Utils\Cache::class, function() {
66 66
             return new Utils\Cache();
67 67
         });
68 68
 
69
-        $this->app->singleton(Utils\WidgetRenderer::class, function () {
69
+        $this->app->singleton(Utils\WidgetRenderer::class, function() {
70 70
             return new Utils\WidgetRenderer();
71 71
         });
72 72
 
Please login to merge, or discard this patch.