Passed
Pull Request — master (#68)
by yasin
02:44
created
src/Utils/SlotRenderer.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@
 block discarded – undo
30 30
      */
31 31
     private function assignSlots()
32 32
     {
33
-        if ($this->hasSlot())
34
-            $this->_viewData = array_merge($this->_viewData, $this->slots);
33
+        if ($this->hasSlot()) {
34
+                    $this->_viewData = array_merge($this->_viewData, $this->slots);
35
+        }
35 36
     }
36 37
 }
Please login to merge, or discard this patch.
src/Utils/WidgetRenderer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         }
35 35
 
36 36
         if (is_array($widget)) {
37
-            $widget = (object) $widget;
37
+            $widget = (object)$widget;
38 38
         }
39 39
 
40 40
         event('widgetize.rendering_widget', [$widget]);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             return resolve($widget);
59 59
         }
60 60
 
61
-        $widget = app()->getNamespace().'Widgets\\'.$widget;
61
+        $widget = app()->getNamespace() . 'Widgets\\' . $widget;
62 62
 
63 63
         return resolve($widget);
64 64
     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     private function generateHtml($widget, ...$args)
75 75
     {
76 76
         // Everything inside this function is executed only when the cache is not available.
77
-        $expensivePhpCode = function () use ($widget, $args) {
77
+        $expensivePhpCode = function() use ($widget, $args) {
78 78
             $this->makeDataForView($widget, $args);
79 79
 
80 80
             $this->assignSlots();
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             return $this->renderTemplate($widget, ...$args);
83 83
         };
84 84
 
85
-        if (! $widget->cacheView) {
85
+        if (!$widget->cacheView) {
86 86
             return $expensivePhpCode();
87 87
         }
88 88
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     private function makeDataForView($widget, array $args)
100 100
     {
101
-        $expensiveCode = function () use ($widget, $args) {
101
+        $expensiveCode = function() use ($widget, $args) {
102 102
             $viewData = $this->callController($widget, $args);
103 103
 
104 104
             if ($widget->presenter) {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         try {
132 132
             $this->html = view($widget->template, $data)->render();
133 133
         } catch (\Throwable $t) {
134
-            throw new \ErrorException('There was some error rendering '.get_class($widget).', template file: \''.$widget->template.'\' Error: '.$t->getMessage());
134
+            throw new \ErrorException('There was some error rendering ' . get_class($widget) . ', template file: \'' . $widget->template . '\' Error: ' . $t->getMessage());
135 135
         }
136 136
 
137 137
         // We try to minify the html before storing it in cache to save space.
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
     private function callController($widget, array $args)
152 152
     {
153
-        if (! isset($widget->controller)) {
153
+        if (!isset($widget->controller)) {
154 154
             $viewData = [];
155 155
         } elseif (is_array($widget->controller) && is_string($widget->controller[0])) {
156 156
             $viewData = call_user_func_array($widget->controller, $args);
Please login to merge, or discard this patch.
src/WidgetsServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $omitParenthesis = version_compare($this->app->version(), '5.3', '<');
42 42
 
43
-        Blade::directive('widget', function ($expression) use ($omitParenthesis) {
43
+        Blade::directive('widget', function($expression) use ($omitParenthesis) {
44 44
             $expression = $omitParenthesis ? $expression : "($expression)";
45 45
 
46 46
             return "<?php echo app(\\Imanghafoori\\Widgets\\Utils\\WidgetRenderer::class)->renderWidget{$expression}; ?>";
47 47
         });
48 48
 
49
-        Blade::directive('slotWidget', function ($expression) use ($omitParenthesis)  {
49
+        Blade::directive('slotWidget', function($expression) use ($omitParenthesis)  {
50 50
             $this->expression = $omitParenthesis ? $expression : "($expression)";
51 51
         });
52 52
 
53 53
         $this->defineSlotDirectives($omitParenthesis);
54 54
 
55
-        Blade::directive('endSlotWidget', function () {
55
+        Blade::directive('endSlotWidget', function() {
56 56
             $expression = $this->expression;
57 57
             return "<?php echo app(\\Imanghafoori\\Widgets\\Utils\\WidgetRenderer::class)->renderWidget{$expression}; ?>";
58 58
         });
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
      */
71 71
     private function defineSlotDirectives($omitParenthesis)
72 72
     {
73
-        Blade::directive('slot', function ($slotName) use ($omitParenthesis) {
73
+        Blade::directive('slot', function($slotName) use ($omitParenthesis) {
74 74
             $slotName = $omitParenthesis ? $slotName : "($slotName)";
75 75
             return "<?php echo app(\\Imanghafoori\\Widgets\\Utils\\WidgetRenderer::class)->startSlot{$slotName};?>";
76 76
         });
77 77
 
78
-        Blade::directive('endSlot', function () {
78
+        Blade::directive('endSlot', function() {
79 79
             $contentKey = '$content';
80 80
             return "<?php 
81 81
                         $contentKey = ob_get_clean();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             return;
104 104
         }
105 105
 
106
-        $this->app->singleton('widgetize.debugger', function () {
106
+        $this->app->singleton('widgetize.debugger', function() {
107 107
             return new MessagesCollector('Widgets');
108 108
         });
109 109
 
Please login to merge, or discard this patch.