@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return app($widget); |
57 | 57 | } |
58 | 58 | |
59 | - $widget = app()->getNamespace().'Widgets\\'.$widget; |
|
59 | + $widget = app()->getNamespace() . 'Widgets\\' . $widget; |
|
60 | 60 | |
61 | 61 | return app($widget); |
62 | 62 | } |
@@ -72,7 +72,7 @@ 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 | // render the template with the resulting data. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | private function makeDataForView($widget, array $args) |
97 | 97 | { |
98 | - $expensiveCode = function () use ($widget, $args) { |
|
98 | + $expensiveCode = function() use ($widget, $args) { |
|
99 | 99 | |
100 | 100 | // Here we call the data method on the widget class. |
101 | 101 | $viewData = \App::call($widget->controller, ...$args); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | return $viewData; |
111 | 111 | }; |
112 | 112 | |
113 | - if (! $widget->cacheView) { |
|
113 | + if (!$widget->cacheView) { |
|
114 | 114 | $viewData = app(Cache::class)->cacheResult($args, $expensiveCode, $widget, 'dataProvider'); |
115 | 115 | } else { |
116 | 116 | $viewData = $expensiveCode(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $cache = app('cache'); |
33 | 33 | |
34 | - if (! empty($widgetObj->cacheTags) && $this->cacheDriverSupportsTags()) { |
|
34 | + if (!empty($widgetObj->cacheTags) && $this->cacheDriverSupportsTags()) { |
|
35 | 35 | $cache = $cache->tags($widgetObj->cacheTags); |
36 | 36 | } |
37 | 37 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $_key = json_encode($widget->extraCacheKeyDependency($arg)); |
65 | 65 | } |
66 | 66 | |
67 | - if (! $this->cacheDriverSupportsTags()) { |
|
67 | + if (!$this->cacheDriverSupportsTags()) { |
|
68 | 68 | $_key .= json_encode($this->getTagTokens($widget->cacheTags)); |
69 | 69 | } |
70 | 70 | |
71 | - $_key .= json_encode($arg, JSON_FORCE_OBJECT).app()->getLocale().$form.$widget->template.get_class($widget); |
|
71 | + $_key .= json_encode($arg, JSON_FORCE_OBJECT) . app()->getLocale() . $form . $widget->template . get_class($widget); |
|
72 | 72 | |
73 | 73 | return md5($_key); |
74 | 74 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function cacheDriverSupportsTags() : bool |
81 | 81 | { |
82 | - return ! in_array(config('cache.default', 'file'), ['file', 'database']); |
|
82 | + return !in_array(config('cache.default', 'file'), ['file', 'database']); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function getTagTokens(array $cacheTags) |
90 | 90 | { |
91 | - return array_map(function ($tag) { |
|
91 | + return array_map(function($tag) { |
|
92 | 92 | return $this->_cacheTag->getTagToken($tag); |
93 | 93 | }, $cacheTags); |
94 | 94 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return \Cache::tags($tags)->flush(); |
104 | 104 | } |
105 | 105 | |
106 | - foreach ((array) $tags as $tag) { |
|
106 | + foreach ((array)$tags as $tag) { |
|
107 | 107 | $this->_cacheTag->generateNewToken($tag); |
108 | 108 | } |
109 | 109 | } |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function normalize($widget): void |
16 | 16 | { |
17 | - if (! property_exists($widget, 'cacheLifeTime')) { |
|
17 | + if (!property_exists($widget, 'cacheLifeTime')) { |
|
18 | 18 | $M = config('widgetize.default_cache_lifetime', 0); |
19 | 19 | $widget->cacheLifeTime = $this->makeFromSeconds($M * 60); |
20 | 20 | } |
21 | 21 | |
22 | - if (! property_exists($widget, 'cacheView')) { |
|
22 | + if (!property_exists($widget, 'cacheView')) { |
|
23 | 23 | $widget->cacheView = true; |
24 | 24 | } |
25 | 25 | |
@@ -41,6 +41,6 @@ discard block |
||
41 | 41 | |
42 | 42 | public function makeFromSeconds($s) |
43 | 43 | { |
44 | - return new \DateInterval('PT'.(string) ceil($s).'S'); |
|
44 | + return new \DateInterval('PT' . (string)ceil($s) . 'S'); |
|
45 | 45 | } |
46 | 46 | } |