@@ -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); |
| 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 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | { |
| 166 | 166 | $query->withCount( |
| 167 | 167 | [ |
| 168 | - 'posts' => static function ($query) { |
|
| 168 | + 'posts' => static function($query) { |
|
| 169 | 169 | $query->isPublished(); |
| 170 | 170 | } |
| 171 | 171 | ] |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * @var Collection | array |
| 23 | 23 | */ |
| 24 | - public $tags = []; |
|
| 24 | + public $tags = [ ]; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Reference to the page name for linking to tag page |
@@ -249,15 +249,15 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function onRun() |
| 251 | 251 | { |
| 252 | - $this->tagPage = (string) $this->getProperty('tagPage'); |
|
| 253 | - $this->tagsPage = (string) $this->getProperty('tagsPage'); |
|
| 252 | + $this->tagPage = (string)$this->getProperty('tagPage'); |
|
| 253 | + $this->tagsPage = (string)$this->getProperty('tagsPage'); |
|
| 254 | 254 | |
| 255 | 255 | $this->orderBy = $this->getProperty('orderBy'); |
| 256 | 256 | $this->postSlug = $this->getProperty('postSlug'); |
| 257 | - $this->displayEmpty = (bool) $this->getProperty('displayEmpty'); |
|
| 258 | - $this->limit = (int) $this->getProperty('limit'); |
|
| 259 | - $this->exposeTotalCount = (bool) $this->getProperty('exposeTotalCount'); |
|
| 260 | - $this->enableTagFilter = (string) $this->getProperty('enableTagFilter'); |
|
| 257 | + $this->displayEmpty = (bool)$this->getProperty('displayEmpty'); |
|
| 258 | + $this->limit = (int)$this->getProperty('limit'); |
|
| 259 | + $this->exposeTotalCount = (bool)$this->getProperty('exposeTotalCount'); |
|
| 260 | + $this->enableTagFilter = (string)$this->getProperty('enableTagFilter'); |
|
| 261 | 261 | |
| 262 | 262 | $this->tags = $this->listTags(); |
| 263 | 263 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | $this->tagsPageUrl = $this->controller->pageUrl($this->tagsPage); |
| 292 | 292 | |
| 293 | - $this->setUrls($tags, $this->tagPage, $this->controller, ['tag' => $this->urlProperty($tagComponent, 'tag')]); |
|
| 293 | + $this->setUrls($tags, $this->tagPage, $this->controller, [ 'tag' => $this->urlProperty($tagComponent, 'tag') ]); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |