@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @var Collection | array |
23 | 23 | */ |
24 | - public $posts = []; |
|
24 | + public $posts = [ ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @var integer The current page |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | // Paginator settings |
150 | 150 | $this->currentPage = (int)$this->property('page', 1) ?: (int)post('page'); |
151 | 151 | $this->resultsPerPage = (int)$this->property('resultsPerPage') |
152 | - ?: $this->defineProperties()['resultsPerPage']['default']; |
|
152 | + ?: $this->defineProperties()[ 'resultsPerPage' ][ 'default' ]; |
|
153 | 153 | |
154 | - $this->orderBy = $this->page['orderBy'] = $this->property('orderBy'); |
|
154 | + $this->orderBy = $this->page[ 'orderBy' ] = $this->property('orderBy'); |
|
155 | 155 | |
156 | 156 | // Page links |
157 | - $this->postPage = $this->page['postPage' ] = $this->property('postPage'); |
|
158 | - $this->categoryPage = $this->page['categoryPage'] = $this->property('categoryPage'); |
|
157 | + $this->postPage = $this->page[ 'postPage' ] = $this->property('postPage'); |
|
158 | + $this->categoryPage = $this->page[ 'categoryPage' ] = $this->property('categoryPage'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -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 ($blogCategoriesComponent) { |
|
77 | + $post->categories->each(function($category) use ($blogCategoriesComponent) { |
|
78 | 78 | /** @var Category $category */ |
79 | 79 | $category->setUrl( |
80 | 80 | $this->categoryPage, |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getProperty(string $property, $default = null) |
115 | 115 | { |
116 | - return $this->property($property, $this->defineProperties()[$property]['default'] ?? $default); |
|
116 | + return $this->property($property, $this->defineProperties()[ $property ][ 'default' ] ?? $default); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $component = $page->getComponent($componentName); |
132 | 132 | } |
133 | 133 | |
134 | - if (!empty($component) && \is_callable([$this->controller, 'setComponentPropertiesFromParams'])) { |
|
134 | + if (!empty($component) && \is_callable([ $this->controller, 'setComponentPropertiesFromParams' ])) { |
|
135 | 135 | $this->controller->setComponentPropertiesFromParams($component); |
136 | 136 | } |
137 | 137 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * @var array |
22 | 22 | */ |
23 | - public static $sortingOptions = []; |
|
23 | + public static $sortingOptions = [ ]; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Sets the URL attribute with a URL to this object |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return mixed |
55 | 55 | */ |
56 | - public function scopeListFrontend(Builder $query, array $options = []) |
|
56 | + public function scopeListFrontend(Builder $query, array $options = [ ]) |
|
57 | 57 | { |
58 | 58 | $this->withRelation($query); |
59 | 59 | |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private function queryDisplayEmpty(Builder $query, array $options) |
100 | 100 | { |
101 | - if (empty($options['displayEmpty'])) { |
|
101 | + if (empty($options[ 'displayEmpty' ])) { |
|
102 | 102 | $query->withCount( |
103 | 103 | [ |
104 | - 'posts' => function ($query) { |
|
104 | + 'posts' => function($query) { |
|
105 | 105 | $query->isPublished(); |
106 | 106 | } |
107 | 107 | ] |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | $connectionConfig = $query->getConnection()->getConfig(); |
111 | 111 | |
112 | 112 | // GROUP BY is required for SQLite-based installations |
113 | - if (!empty($connectionConfig['name']) && |
|
114 | - strtolower($connectionConfig['name']) === self::CONNECTION_SQLITE |
|
113 | + if (!empty($connectionConfig[ 'name' ]) && |
|
114 | + strtolower($connectionConfig[ 'name' ]) === self::CONNECTION_SQLITE |
|
115 | 115 | ) { |
116 | 116 | $query->groupBy('id'); |
117 | 117 | } |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | */ |
127 | 127 | private function queryPostSlug(Builder $query, array $options) |
128 | 128 | { |
129 | - if (!empty($options['post'])) { |
|
129 | + if (!empty($options[ 'post' ])) { |
|
130 | 130 | $query->whereHas( |
131 | 131 | 'posts', |
132 | - function ($query) use ($options) { |
|
133 | - ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']); |
|
132 | + function($query) use ($options) { |
|
133 | + ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]); |
|
134 | 134 | } |
135 | 135 | ); |
136 | 136 | } |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private function queryLimit(Builder $query, array $options) |
146 | 146 | { |
147 | - if (!empty($options['limit'])) { |
|
148 | - $query->take($options['limit']); |
|
147 | + if (!empty($options[ 'limit' ])) { |
|
148 | + $query->take($options[ 'limit' ]); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -157,16 +157,16 @@ discard block |
||
157 | 157 | */ |
158 | 158 | private function queryOrderBy(Builder $query, array $options) |
159 | 159 | { |
160 | - if (\array_key_exists($options['sort'], static::$sortingOptions)) { |
|
161 | - if ($options['sort'] === 'random') { |
|
160 | + if (\array_key_exists($options[ 'sort' ], static::$sortingOptions)) { |
|
161 | + if ($options[ 'sort' ] === 'random') { |
|
162 | 162 | $query->inRandomOrder(); |
163 | 163 | } else { |
164 | - list($sortField, $sortDirection) = explode(' ', $options['sort']); |
|
164 | + list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]); |
|
165 | 165 | |
166 | 166 | if ($sortField === 'posts_count') { |
167 | 167 | $query->withCount( |
168 | 168 | [ |
169 | - 'posts' => function ($query) { |
|
169 | + 'posts' => function($query) { |
|
170 | 170 | $query->isPublished(); |
171 | 171 | } |
172 | 172 | ] |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | $query->with( |
189 | 189 | [ |
190 | - 'posts' => function ($query) { |
|
190 | + 'posts' => function($query) { |
|
191 | 191 | $query->isPublished(); |
192 | 192 | } |
193 | 193 | ] |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @var array |
39 | 39 | */ |
40 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
40 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Translatable properties, indexed property will be available in queries |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * @var array |
123 | 123 | */ |
124 | - protected $slugs = ['slug' => 'title']; |
|
124 | + protected $slugs = [ 'slug' => 'title' ]; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @return mixed |