@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $cache = app('cache'); |
32 | 32 | |
33 | - if (! empty($widgetObj->cacheTags) && $this->cacheDriverSupportsTags()) { |
|
33 | + if (!empty($widgetObj->cacheTags) && $this->cacheDriverSupportsTags()) { |
|
34 | 34 | $cache = $cache->tags($widgetObj->cacheTags); |
35 | 35 | } |
36 | 36 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | $_key = json_encode($widget->extraCacheKeyDependency($arg)); |
62 | 62 | } |
63 | 63 | |
64 | - if (! $this->cacheDriverSupportsTags()) { |
|
64 | + if (!$this->cacheDriverSupportsTags()) { |
|
65 | 65 | $_key .= json_encode($this->getTagTokens($widget->cacheTags)); |
66 | 66 | } |
67 | 67 | |
68 | - $_key .= json_encode($arg, JSON_FORCE_OBJECT).app()->getLocale().$form.$widget->template.get_class($widget); |
|
68 | + $_key .= json_encode($arg, JSON_FORCE_OBJECT) . app()->getLocale() . $form . $widget->template . get_class($widget); |
|
69 | 69 | |
70 | 70 | return md5($_key); |
71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function cacheDriverSupportsTags() |
78 | 78 | { |
79 | - return ! in_array(config('cache.default', 'file'), ['file', 'database']); |
|
79 | + return !in_array(config('cache.default', 'file'), ['file', 'database']); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | private function getTagTokens(array $cacheTags) |
87 | 87 | { |
88 | - return array_map(function ($tag) { |
|
88 | + return array_map(function($tag) { |
|
89 | 89 | return $this->_cacheTag->getTagToken($tag); |
90 | 90 | }, $cacheTags); |
91 | 91 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | private function checkControllerExists($ctrlClass) |
26 | 26 | { |
27 | - if (! class_exists($ctrlClass)) { |
|
27 | + if (!class_exists($ctrlClass)) { |
|
28 | 28 | throw new \InvalidArgumentException("Controller class: [{$ctrlClass}] not found."); |
29 | 29 | } |
30 | 30 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | private function checkDataMethodExists($ctrlClass) |
36 | 36 | { |
37 | - if (! method_exists($ctrlClass, 'data')) { |
|
38 | - throw new \InvalidArgumentException("'data' method not found on ".$ctrlClass); |
|
37 | + if (!method_exists($ctrlClass, 'data')) { |
|
38 | + throw new \InvalidArgumentException("'data' method not found on " . $ctrlClass); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // then we decide to call data method on that instead. |
54 | 54 | if (property_exists($widget, 'controller')) { |
55 | 55 | $ctrlClass = $widget->controller; |
56 | - $controllerMethod = ($ctrlClass).'@data'; |
|
56 | + $controllerMethod = ($ctrlClass) . '@data'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return [$controllerMethod, $ctrlClass]; |
@@ -1,20 +1,20 @@ |
||
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); |
7 | 7 | } |
8 | 8 | } |
9 | 9 | |
10 | -if (! function_exists('expire_widgets')) { |
|
10 | +if (!function_exists('expire_widgets')) { |
|
11 | 11 | function expire_widgets($tags) |
12 | 12 | { |
13 | 13 | return app(\Imanghafoori\Widgets\Utils\Cache::class)->expireTaggedWidgets($tags); |
14 | 14 | } |
15 | 15 | } |
16 | 16 | |
17 | -if (! function_exists('json_widget')) { |
|
17 | +if (!function_exists('json_widget')) { |
|
18 | 18 | function json_widget($widget, ...$args) |
19 | 19 | { |
20 | 20 | return app(\Imanghafoori\Widgets\Utils\WidgetJsonifier::class)->jsonResponse($widget, ...$args); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | private function _makeWidgetObj($widget) |
36 | 36 | { |
37 | - $widget = app()->getNamespace().'Widgets\\'.$widget; |
|
37 | + $widget = app()->getNamespace() . 'Widgets\\' . $widget; |
|
38 | 38 | |
39 | 39 | return app($widget); |
40 | 40 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | private function _generateJson($widget, ...$args) |
51 | 51 | { |
52 | 52 | // Everything inside this function is executed only when the cache is not available. |
53 | - $expensivePhpCode = function () use ($widget, $args) { |
|
53 | + $expensivePhpCode = function() use ($widget, $args) { |
|
54 | 54 | $data = \App::call($widget->controller, ...$args); |
55 | 55 | |
56 | 56 | // render the template with the resulting data. |