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