@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if (is_array($widget)) { |
| 33 | - $widget = (object) $widget; |
|
| 33 | + $widget = (object)$widget; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | event('widgetize.rendering_widget', [$widget]); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | return app($widget); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $widget = app()->getNamespace().'Widgets\\'.$widget; |
|
| 57 | + $widget = app()->getNamespace() . 'Widgets\\' . $widget; |
|
| 58 | 58 | |
| 59 | 59 | return app($widget); |
| 60 | 60 | } |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | private function generateHtml($widget, ...$args) |
| 71 | 71 | { |
| 72 | 72 | // Everything inside this function is executed only when the cache is not available. |
| 73 | - $expensivePhpCode = function () use ($widget, $args) { |
|
| 73 | + $expensivePhpCode = function() use ($widget, $args) { |
|
| 74 | 74 | $this->makeDataForView($widget, $args); |
| 75 | 75 | |
| 76 | 76 | return $this->renderTemplate($widget, ...$args); |
| 77 | 77 | }; |
| 78 | 78 | |
| 79 | - if (! $widget->cacheView) { |
|
| 79 | + if (!$widget->cacheView) { |
|
| 80 | 80 | return $expensivePhpCode(); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | private function makeDataForView($widget, array $args) |
| 94 | 94 | { |
| 95 | - $expensiveCode = function () use ($widget, $args) { |
|
| 95 | + $expensiveCode = function() use ($widget, $args) { |
|
| 96 | 96 | $viewData = $this->callController($widget, $args); |
| 97 | 97 | |
| 98 | 98 | if ($widget->presenter) { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | try { |
| 126 | 126 | $this->html = view($widget->template, $data)->render(); |
| 127 | 127 | } catch (\Throwable $t) { |
| 128 | - throw new \ErrorException('There was some error rendering '.get_class($widget).', template file: \''.$widget->template.'\' Error: '.$t->getMessage()); |
|
| 128 | + throw new \ErrorException('There was some error rendering ' . get_class($widget) . ', template file: \'' . $widget->template . '\' Error: ' . $t->getMessage()); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // We try to minify the html before storing it in cache to save space. |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | private function callController($widget, array $args) |
| 146 | 146 | { |
| 147 | - if (! isset($widget->controller)) { |
|
| 147 | + if (!isset($widget->controller)) { |
|
| 148 | 148 | $viewData = []; |
| 149 | 149 | } elseif (is_array($widget->controller) && is_string($widget->controller[0])) { |
| 150 | 150 | $viewData = call_user_func_array($widget->controller, $args); |