@@ -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 | ] |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * @var Collection | array |
| 25 | 25 | */ |
| 26 | - public $posts = []; |
|
| 26 | + public $posts = [ ]; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @var integer The current page |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | { |
| 276 | 276 | $this->currentPage = (int)$this->property('page', 1) ?: (int)post('page'); |
| 277 | 277 | $this->resultsPerPage = (int)$this->property('resultsPerPage') |
| 278 | - ?: $this->defineProperties()['resultsPerPage']['default']; |
|
| 278 | + ?: $this->defineProperties()[ 'resultsPerPage' ][ 'default' ]; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -341,16 +341,16 @@ discard block |
||
| 341 | 341 | private function separateParameters(array $parameters): array |
| 342 | 342 | { |
| 343 | 343 | $slugs = $parameters; |
| 344 | - $ids = []; |
|
| 344 | + $ids = [ ]; |
|
| 345 | 345 | |
| 346 | 346 | foreach ($slugs as $index => $potentialId) { |
| 347 | 347 | if (is_numeric($potentialId)) { |
| 348 | - $ids[] = $potentialId; |
|
| 349 | - unset($slugs[$index]); |
|
| 348 | + $ids[ ] = $potentialId; |
|
| 349 | + unset($slugs[ $index ]); |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - return [$ids, $slugs]; |
|
| 353 | + return [ $ids, $slugs ]; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | if (!empty($this->exceptCategories)) { |
| 363 | 363 | list($ids, $slugs) = $this->separateParameters($this->exceptCategories); |
| 364 | 364 | |
| 365 | - $query->whereDoesntHave('categories', static function ($innerQuery) use ($ids, $slugs) { |
|
| 365 | + $query->whereDoesntHave('categories', static function($innerQuery) use ($ids, $slugs) { |
|
| 366 | 366 | if (!empty($ids)) { |
| 367 | 367 | $innerQuery->whereIn('id', $ids); |
| 368 | 368 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; |
|
| 43 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Translatable properties, indexed property will be available in queries |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * @var array |
| 143 | 143 | */ |
| 144 | - protected $slugs = ['slug' => 'title']; |
|
| 144 | + protected $slugs = [ 'slug' => 'title' ]; |
|
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | 147 | * @param Builder $query |
@@ -49,12 +49,12 @@ |
||
| 49 | 49 | { |
| 50 | 50 | Schema::create( |
| 51 | 51 | Series::RELATED_SERIES_TABLE_NAME, |
| 52 | - function ($table) { |
|
| 52 | + function($table) { |
|
| 53 | 53 | $table->engine = 'InnoDB'; |
| 54 | 54 | |
| 55 | 55 | $table->integer('series_id')->unsigned(); |
| 56 | 56 | $table->integer('related_series_id')->unsigned(); |
| 57 | - $table->index(['series_id', 'related_series_id']); |
|
| 57 | + $table->index([ 'series_id', 'related_series_id' ]); |
|
| 58 | 58 | $table->foreign('series_id', 'Series reference')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade'); |
| 59 | 59 | $table->foreign('related_series_id', 'Related series reference')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade'); |
| 60 | 60 | } |