@@ -146,8 +146,8 @@ |
||
146 | 146 | { |
147 | 147 | $this->seriesPage = $this->getProperty('seriesPage'); |
148 | 148 | $this->orderBy = $this->getProperty('orderBy'); |
149 | - $this->displayEmpty = (bool) $this->getProperty('displayEmpty'); |
|
150 | - $this->fetchPosts = (bool) $this->getProperty('fetchPosts'); |
|
149 | + $this->displayEmpty = (bool)$this->getProperty('displayEmpty'); |
|
150 | + $this->fetchPosts = (bool)$this->getProperty('fetchPosts'); |
|
151 | 151 | $this->limit = $this->getProperty('limit'); |
152 | 152 | |
153 | 153 | $this->series = $this->listSeries(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @var Collection | array |
25 | 25 | */ |
26 | - public $tags = []; |
|
26 | + public $tags = [ ]; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Reference to the page name for linking to tag page |
@@ -268,16 +268,16 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public function onRun() |
270 | 270 | { |
271 | - $this->tagPage = (string) $this->getProperty('tagPage'); |
|
272 | - $this->tagsPage = (string) $this->getProperty('tagsPage'); |
|
271 | + $this->tagPage = (string)$this->getProperty('tagPage'); |
|
272 | + $this->tagsPage = (string)$this->getProperty('tagsPage'); |
|
273 | 273 | |
274 | 274 | $this->orderBy = $this->getProperty('orderBy'); |
275 | 275 | $this->postSlug = $this->getProperty('postSlug'); |
276 | - $this->fetchPosts = (bool) $this->getProperty('fetchPosts'); |
|
277 | - $this->displayEmpty = (bool) $this->getProperty('displayEmpty'); |
|
278 | - $this->limit = (int) $this->getProperty('limit'); |
|
279 | - $this->exposeTotalCount = (bool) $this->getProperty('exposeTotalCount'); |
|
280 | - $this->enableTagFilter = (string) $this->getProperty('enableTagFilter'); |
|
276 | + $this->fetchPosts = (bool)$this->getProperty('fetchPosts'); |
|
277 | + $this->displayEmpty = (bool)$this->getProperty('displayEmpty'); |
|
278 | + $this->limit = (int)$this->getProperty('limit'); |
|
279 | + $this->exposeTotalCount = (bool)$this->getProperty('exposeTotalCount'); |
|
280 | + $this->enableTagFilter = (string)$this->getProperty('enableTagFilter'); |
|
281 | 281 | |
282 | 282 | $this->tags = $this->listTags(); |
283 | 283 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | |
312 | 312 | $this->tagsPageUrl = $this->controller->pageUrl($this->tagsPage); |
313 | 313 | |
314 | - $this->setUrls($tags, $this->tagPage, $this->controller, ['tag' => $this->urlProperty($tagComponent, 'tag')]); |
|
314 | + $this->setUrls($tags, $this->tagPage, $this->controller, [ 'tag' => $this->urlProperty($tagComponent, 'tag') ]); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ); |
75 | 75 | |
76 | 76 | if (!empty($this->categoryPage) && $post->categories->count()) { |
77 | - $post->categories->each(function ($category) use ($blogPostsComponent) { |
|
77 | + $post->categories->each(function($category) use ($blogPostsComponent) { |
|
78 | 78 | /** @var Category $category */ |
79 | 79 | $category->setUrl( |
80 | 80 | $this->categoryPage, |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | if ($component !== null && ($property = $component->property($name))) { |
107 | 107 | preg_match('/{{ :([^ ]+) }}/', $property, $matches); |
108 | 108 | |
109 | - if (isset($matches[1])) { |
|
110 | - $property = $matches[1]; |
|
109 | + if (isset($matches[ 1 ])) { |
|
110 | + $property = $matches[ 1 ]; |
|
111 | 111 | } |
112 | 112 | } else { |
113 | 113 | $property = $name; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function getProperty(string $property, $default = null) |
129 | 129 | { |
130 | - return $this->property($property, $this->defineProperties()[$property]['default'] ?? $default); |
|
130 | + return $this->property($property, $this->defineProperties()[ $property ][ 'default' ] ?? $default); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * @var array |
20 | 20 | */ |
21 | - public static $sortingOptions = []; |
|
21 | + public static $sortingOptions = [ ]; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Sets the URL attribute with a URL to this object |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return mixed |
53 | 53 | */ |
54 | - public function scopeListFrontend(Builder $query, array $options = []) |
|
54 | + public function scopeListFrontend(Builder $query, array $options = [ ]) |
|
55 | 55 | { |
56 | 56 | $this->withRelation($query, $options); |
57 | 57 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private function queryDisplayEmpty(Builder $query, array $options) |
103 | 103 | { |
104 | - if (empty($options['displayEmpty'])) { |
|
104 | + if (empty($options[ 'displayEmpty' ])) { |
|
105 | 105 | $query->having('posts_count', '>', 0); |
106 | 106 | } |
107 | 107 | } |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function queryPostSlug(Builder $query, array $options) |
116 | 116 | { |
117 | - if (!empty($options['post'])) { |
|
117 | + if (!empty($options[ 'post' ])) { |
|
118 | 118 | $query->whereHas( |
119 | 119 | 'posts', |
120 | - static function ($query) use ($options) { |
|
121 | - ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']); |
|
120 | + static function($query) use ($options) { |
|
121 | + ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]); |
|
122 | 122 | } |
123 | 123 | ); |
124 | 124 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | */ |
133 | 133 | private function queryLimit(Builder $query, array $options) |
134 | 134 | { |
135 | - if (!empty($options['limit'])) { |
|
136 | - $query->take($options['limit']); |
|
135 | + if (!empty($options[ 'limit' ])) { |
|
136 | + $query->take($options[ 'limit' ]); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | */ |
146 | 146 | private function queryOrderBy(Builder $query, array $options) |
147 | 147 | { |
148 | - if (!empty($options['sort']) && \array_key_exists($options['sort'], static::$sortingOptions)) { |
|
149 | - if ($options['sort'] === 'random') { |
|
148 | + if (!empty($options[ 'sort' ]) && \array_key_exists($options[ 'sort' ], static::$sortingOptions)) { |
|
149 | + if ($options[ 'sort' ] === 'random') { |
|
150 | 150 | $query->inRandomOrder(); |
151 | 151 | } else { |
152 | - list($sortField, $sortDirection) = explode(' ', $options['sort']); |
|
152 | + list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]); |
|
153 | 153 | |
154 | 154 | $query->orderBy($sortField, $sortDirection); |
155 | 155 | } |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function withRelation(Builder $query, array $options) |
166 | 166 | { |
167 | - if (!empty($options['fetchPosts'])) { |
|
167 | + if (!empty($options[ 'fetchPosts' ])) { |
|
168 | 168 | $query->with( |
169 | 169 | [ |
170 | - 'posts' => static function ($query) { |
|
170 | + 'posts' => static function($query) { |
|
171 | 171 | $query->isPublished(); |
172 | 172 | } |
173 | 173 | ] |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $query->withCount( |
178 | 178 | [ |
179 | - 'posts' => static function ($query) { |
|
179 | + 'posts' => static function($query) { |
|
180 | 180 | $query->isPublished(); |
181 | 181 | } |
182 | 182 | ] |