@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | $presenter = $widget->presenter; |
16 | 16 | $this->checkPresenterExists($presenter); |
17 | 17 | } else { |
18 | - $presenter = get_class($widget).'Presenter'; |
|
19 | - if (! class_exists($presenter)) { |
|
18 | + $presenter = get_class($widget) . 'Presenter'; |
|
19 | + if (!class_exists($presenter)) { |
|
20 | 20 | return $widget->presenter = null; |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | 24 | $this->checkPresentMethodExists($presenter); |
25 | 25 | |
26 | - $widget->presenter = $presenter.'@present'; |
|
26 | + $widget->presenter = $presenter . '@present'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | private function checkPresentMethodExists($presenter) |
33 | 33 | { |
34 | - if (! method_exists($presenter, 'present')) { |
|
35 | - throw new \InvalidArgumentException("'present' method not found on : ".$presenter); |
|
34 | + if (!method_exists($presenter, 'present')) { |
|
35 | + throw new \InvalidArgumentException("'present' method not found on : " . $presenter); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | private function checkPresenterExists($presenter) |
43 | 43 | { |
44 | - if (! class_exists($presenter)) { |
|
44 | + if (!class_exists($presenter)) { |
|
45 | 45 | throw new \InvalidArgumentException("Presenter Class [{$presenter}] not found."); |
46 | 46 | } |
47 | 47 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function widgetShouldUseCache() |
25 | 25 | { |
26 | - return config('widgetize.enable_cache') && (! app()->environment('testing')); |
|
26 | + return config('widgetize.enable_cache') && (!app()->environment('testing')); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -17,12 +17,12 @@ |
||
17 | 17 | // replace slashes with dots |
18 | 18 | $className = str_replace(['\\', '/'], '.', $className); |
19 | 19 | |
20 | - if (! property_exists($widget, 'template')) { |
|
21 | - $widget->template = 'Widgets::'.$className.'View'; |
|
20 | + if (!property_exists($widget, 'template')) { |
|
21 | + $widget->template = 'Widgets::' . $className . 'View'; |
|
22 | 22 | } |
23 | 23 | |
24 | - if (! view()->exists($widget->template)) { |
|
25 | - throw new \InvalidArgumentException("View file \"{$widget->template}\" not found by: '".get_class($widget)." '"); |
|
24 | + if (!view()->exists($widget->template)) { |
|
25 | + throw new \InvalidArgumentException("View file \"{$widget->template}\" not found by: '" . get_class($widget) . " '"); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | private function persistToken($tag, $token) |
53 | 53 | { |
54 | - \Cache::forever('9z10_o6cg_r'.$tag, $token); |
|
54 | + \Cache::forever('9z10_o6cg_r' . $tag, $token); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,6 +60,6 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function getPersistedToken($tag) |
62 | 62 | { |
63 | - return \Cache::get('9z10_o6cg_r'.$tag, null); |
|
63 | + return \Cache::get('9z10_o6cg_r' . $tag, null); |
|
64 | 64 | } |
65 | 65 | } |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function normalizeCacheLifeTime($widget) |
13 | 13 | { |
14 | - if (! property_exists($widget, 'cacheLifeTime')) { |
|
15 | - $widget->cacheLifeTime = (int) (config('widgetize.default_cache_lifetime', 0)); |
|
14 | + if (!property_exists($widget, 'cacheLifeTime')) { |
|
15 | + $widget->cacheLifeTime = (int)(config('widgetize.default_cache_lifetime', 0)); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if ($widget->cacheLifeTime === 'forever' || $widget->cacheLifeTime < 0) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function normalizeCacheTags($widget) |
30 | 30 | { |
31 | - if (! property_exists($widget, 'cacheTags')) { |
|
31 | + if (!property_exists($widget, 'cacheTags')) { |
|
32 | 32 | return $widget->cacheTags = []; |
33 | 33 | } |
34 | 34 |
@@ -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); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $contextAs = 'data'; |
61 | 61 | if (property_exists($widget, 'contextAs')) { |
62 | 62 | // removes the $ sign. |
63 | - $contextAs = str_replace('$', '', (string) $widget->contextAs); |
|
63 | + $contextAs = str_replace('$', '', (string)$widget->contextAs); |
|
64 | 64 | } |
65 | 65 | $widget->contextAs = $contextAs; |
66 | 66 | } |