| @@ -86,7 +86,7 @@ | ||
| 86 | 86 | * | 
| 87 | 87 | * @var array | 
| 88 | 88 | */ | 
| 89 | - public static $sortingOptions = [ | |
| 89 | + public static $sortingOptions = [ | |
| 90 | 90 | 'name asc' => Plugin::LOCALIZATION_KEY . 'order_options.name_asc', | 
| 91 | 91 | 'name desc' => Plugin::LOCALIZATION_KEY . 'order_options.name_desc', | 
| 92 | 92 | 'created_at asc' => Plugin::LOCALIZATION_KEY . 'order_options.created_at_asc', | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | * | 
| 47 | 47 | * @var array | 
| 48 | 48 | */ | 
| 49 | - public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel']; | |
| 49 | + public $implement = [ '@RainLab.Translate.Behaviors.TranslatableModel' ]; | |
| 50 | 50 | |
| 51 | 51 | /** | 
| 52 | 52 | * Translatable properties, indexed property will be available in queries | 
| @@ -64,7 +64,7 @@ discard block | ||
| 64 | 64 | /** | 
| 65 | 65 | * @var array | 
| 66 | 66 | */ | 
| 67 | - protected $slugs = ['slug' => 'name']; | |
| 67 | + protected $slugs = [ 'slug' => 'name' ]; | |
| 68 | 68 | |
| 69 | 69 | /** | 
| 70 | 70 | * Relations | 
| @@ -72,8 +72,8 @@ discard block | ||
| 72 | 72 | * @var array | 
| 73 | 73 | */ | 
| 74 | 74 | public $morphedByMany = [ | 
| 75 | - 'posts' => [Post::class, 'name' => Tag::PIVOT_COLUMN], | |
| 76 | - 'series' => [Series::class, 'name' => Tag::PIVOT_COLUMN], | |
| 75 | + 'posts' => [ Post::class, 'name' => Tag::PIVOT_COLUMN ], | |
| 76 | + 'series' => [ Series::class, 'name' => Tag::PIVOT_COLUMN ], | |
| 77 | 77 | ]; | 
| 78 | 78 | |
| 79 | 79 | /** | 
| @@ -182,12 +182,12 @@ discard block | ||
| 182 | 182 |      { | 
| 183 | 183 | parent::queryPostSlug($query, $options); | 
| 184 | 184 | |
| 185 | -        if (!empty($options['post']) && !empty($options['includeSeriesTags'])) { | |
| 186 | -            $query->orWhereHas('series', static function ($query) use ($options) { | |
| 185 | +        if (!empty($options[ 'post' ]) && !empty($options[ 'includeSeriesTags' ])) { | |
| 186 | +            $query->orWhereHas('series', static function($query) use ($options) { | |
| 187 | 187 | $query->whereHas( | 
| 188 | 188 | 'posts', | 
| 189 | -                    static function ($query) use ($options) { | |
| 190 | - ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']); | |
| 189 | +                    static function($query) use ($options) { | |
| 190 | + ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]); | |
| 191 | 191 | }); | 
| 192 | 192 | }); | 
| 193 | 193 | } | 
| @@ -201,7 +201,7 @@ discard block | ||
| 201 | 201 | */ | 
| 202 | 202 | protected function queryDisplayEmpty(Builder $query, array $options) | 
| 203 | 203 |      { | 
| 204 | -        if (empty($options['displayEmpty'])) { | |
| 204 | +        if (empty($options[ 'displayEmpty' ])) { | |
| 205 | 205 | $query | 
| 206 | 206 |                  ->having('posts_count', '>', 0) | 
| 207 | 207 |                  ->orHaving('series_count', '>', 0); | 
| @@ -216,10 +216,10 @@ discard block | ||
| 216 | 216 | */ | 
| 217 | 217 | private function postRelation(Builder $query, array $options) | 
| 218 | 218 |      { | 
| 219 | -        if (!empty($options['fetchPosts'])) { | |
| 219 | +        if (!empty($options[ 'fetchPosts' ])) { | |
| 220 | 220 | $query->with( | 
| 221 | 221 | [ | 
| 222 | -                    'posts' => static function (MorphToMany $query) use ($options) { | |
| 222 | +                    'posts' => static function(MorphToMany $query) use ($options) { | |
| 223 | 223 | $query->isPublished(); | 
| 224 | 224 | |
| 225 | 225 | self::handleExceptions($query->getQuery(), $options); | 
| @@ -230,7 +230,7 @@ discard block | ||
| 230 | 230 | |
| 231 | 231 | $query->withCount( | 
| 232 | 232 | [ | 
| 233 | -                'posts' => static function ($query) use ($options) { | |
| 233 | +                'posts' => static function($query) use ($options) { | |
| 234 | 234 | $query->isPublished(); | 
| 235 | 235 | |
| 236 | 236 | self::handleExceptions($query, $options); | 
| @@ -249,13 +249,13 @@ discard block | ||
| 249 | 249 |      { | 
| 250 | 250 |          $query->withCount('series'); | 
| 251 | 251 | |
| 252 | -        if (!empty($options['fetchSeriesPostCount'])) { | |
| 252 | +        if (!empty($options[ 'fetchSeriesPostCount' ])) { | |
| 253 | 253 | $query->with( | 
| 254 | 254 | [ | 
| 255 | -                    'series' => static function (MorphToMany $query) use ($options) { | |
| 255 | +                    'series' => static function(MorphToMany $query) use ($options) { | |
| 256 | 256 | $query->withCount( | 
| 257 | 257 | [ | 
| 258 | -                                'posts' => static function ($query) use ($options) { | |
| 258 | +                                'posts' => static function($query) use ($options) { | |
| 259 | 259 | $query->isPublished(); | 
| 260 | 260 | |
| 261 | 261 | self::handleExceptions($query, $options); | 
| @@ -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 | * Reference to the page name for linking to posts | 
| @@ -126,10 +126,10 @@ discard block | ||
| 126 | 126 | |
| 127 | 127 | private function prepareVars() | 
| 128 | 128 |      { | 
| 129 | -        $this->orderBy = $this->page['orderBy'] = $this->property('orderBy'); | |
| 129 | +        $this->orderBy = $this->page[ 'orderBy' ] = $this->property('orderBy'); | |
| 130 | 130 | |
| 131 | 131 | // Page links | 
| 132 | -        $this->postPage = $this->page['postPage' ] = $this->property('postPage'); | |
| 132 | +        $this->postPage = $this->page[ 'postPage' ] = $this->property('postPage'); | |
| 133 | 133 | } | 
| 134 | 134 | |
| 135 | 135 | public function getPostPageOptions() | 
| @@ -164,7 +164,7 @@ discard block | ||
| 164 | 164 | |
| 165 | 165 | $query = Post::isPublished() | 
| 166 | 166 |              ->where('id', '<>', $post->id) | 
| 167 | -            ->whereHas('tags', function ($tag) use ($tagIds) { | |
| 167 | +            ->whereHas('tags', function($tag) use ($tagIds) { | |
| 168 | 168 |                  $tag->whereIn('id', $tagIds); | 
| 169 | 169 | }) | 
| 170 | 170 |              ->with('tags'); | 
| @@ -109,8 +109,8 @@ | ||
| 109 | 109 |      { | 
| 110 | 110 |          $this->postPage   = $this->property('postPage'); | 
| 111 | 111 |          $this->seriesPage = $this->property('seriesPage'); | 
| 112 | -        $this->slug       = $this->page['slug'] = $this->property('slug'); | |
| 113 | - $this->series = $this->page['series'] = $this->listSeries(); | |
| 112 | +        $this->slug       = $this->page[ 'slug' ] = $this->property('slug'); | |
| 113 | + $this->series = $this->page[ 'series' ] = $this->listSeries(); | |
| 114 | 114 | } | 
| 115 | 115 | |
| 116 | 116 | /** | 
| @@ -64,7 +64,7 @@ | ||
| 64 | 64 | */ | 
| 65 | 65 | protected function getPostsQuery() | 
| 66 | 66 |      { | 
| 67 | -        $query = Post::whereHas('series', function ($query) { | |
| 67 | +        $query = Post::whereHas('series', function($query) { | |
| 68 | 68 |              $query->whereTranslatable('slug', $this->series->slug); | 
| 69 | 69 | })->isPublished(); | 
| 70 | 70 | |
| @@ -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 | /** | 
| @@ -20,7 +20,7 @@ discard block | ||
| 20 | 20 |  { | 
| 21 | 21 | const PLUGIN_NAME = 'PKleindienst.BlogSeries'; | 
| 22 | 22 | |
| 23 | - private $migratedSeriesIds = []; | |
| 23 | + private $migratedSeriesIds = [ ]; | |
| 24 | 24 | |
| 25 | 25 | /** | 
| 26 | 26 | * Migrate plugin data | 
| @@ -90,7 +90,7 @@ discard block | ||
| 90 | 90 | ) | 
| 91 | 91 | ); | 
| 92 | 92 | |
| 93 | - $this->migratedSeriesIds[$blogTaxonomySeries->id] = $seriesRecord->id; | |
| 93 | + $this->migratedSeriesIds[ $blogTaxonomySeries->id ] = $seriesRecord->id; | |
| 94 | 94 | } | 
| 95 | 95 | |
| 96 | 96 |          $this->command->info('All series have been migrated' . PHP_EOL); | 
| @@ -117,13 +117,13 @@ discard block | ||
| 117 | 117 | |
| 118 | 118 | $migratedSeries = array_flip($this->migratedSeriesIds); | 
| 119 | 119 | |
| 120 | -        DB::transaction(function () use ($relatedSeries, $migratedSeries) { | |
| 120 | +        DB::transaction(function() use ($relatedSeries, $migratedSeries) { | |
| 121 | 121 |              foreach ($relatedSeries as $relationRecord) { | 
| 122 | - $seriesId = $migratedSeries[$relationRecord->series_id]; | |
| 123 | - $relatedSeriesId = $migratedSeries[$relationRecord->related_id]; | |
| 122 | + $seriesId = $migratedSeries[ $relationRecord->series_id ]; | |
| 123 | + $relatedSeriesId = $migratedSeries[ $relationRecord->related_id ]; | |
| 124 | 124 | |
| 125 | 125 |                  DB::table('ginopane_blogtaxonomy_related_series')->insert( | 
| 126 | - ['series_id' => $seriesId, 'related_series_id' => $relatedSeriesId] | |
| 126 | + [ 'series_id' => $seriesId, 'related_series_id' => $relatedSeriesId ] | |
| 127 | 127 | ); | 
| 128 | 128 | |
| 129 | 129 | $this->command->line( | 
| @@ -158,11 +158,11 @@ discard block | ||
| 158 | 158 | |
| 159 | 159 | $migratedSeries = array_flip($this->migratedSeriesIds); | 
| 160 | 160 | |
| 161 | -        DB::transaction(function () use ($migratedSeries) { | |
| 161 | +        DB::transaction(function() use ($migratedSeries) { | |
| 162 | 162 |              foreach ($migratedSeries as $oldSeriesId => $newSeriesId) { | 
| 163 | 163 |                  if (DB::table('rainlab_blog_posts') | 
| 164 | 164 |                      ->where('series_id', $oldSeriesId) | 
| 165 | - ->update(['ginopane_blogtaxonomy_series_id' => $newSeriesId]) | |
| 165 | + ->update([ 'ginopane_blogtaxonomy_series_id' => $newSeriesId ]) | |
| 166 | 166 |                  ) { | 
| 167 | 167 | $this->command->line( | 
| 168 | 168 | sprintf( | 
| @@ -24,7 +24,7 @@ discard block | ||
| 24 | 24 | /** | 
| 25 | 25 | * @var Collection | array | 
| 26 | 26 | */ | 
| 27 | - public $posts = []; | |
| 27 | + public $posts = [ ]; | |
| 28 | 28 | |
| 29 | 29 | /** | 
| 30 | 30 | * Parameter to use for the page number | 
| @@ -243,7 +243,7 @@ discard block | ||
| 243 | 243 |          $this->pageParam = $this->paramName('page'); | 
| 244 | 244 |          $this->currentPage = (int)$this->property('page', 1) ?: (int)post('page'); | 
| 245 | 245 |          $this->resultsPerPage = (int)$this->property('resultsPerPage') | 
| 246 | - ?: $this->defineProperties()['resultsPerPage']['default']; | |
| 246 | + ?: $this->defineProperties()[ 'resultsPerPage' ][ 'default' ]; | |
| 247 | 247 | } | 
| 248 | 248 | |
| 249 | 249 | /** | 
| @@ -50,12 +50,12 @@ | ||
| 50 | 50 |          if (!Schema::hasTable(Series::RELATED_SERIES_TABLE_NAME)) { | 
| 51 | 51 | Schema::create( | 
| 52 | 52 | Series::RELATED_SERIES_TABLE_NAME, | 
| 53 | -                static function ($table) { | |
| 53 | +                static function($table) { | |
| 54 | 54 | $table->engine = 'InnoDB'; | 
| 55 | 55 | |
| 56 | 56 |                      $table->integer('series_id')->unsigned(); | 
| 57 | 57 |                      $table->integer('related_series_id')->unsigned(); | 
| 58 | - $table->index(['series_id', 'related_series_id'], 'related_series_index'); | |
| 58 | + $table->index([ 'series_id', 'related_series_id' ], 'related_series_index'); | |
| 59 | 59 | |
| 60 | 60 | $table | 
| 61 | 61 |                          ->foreign('series_id', 'Series reference') | 
| @@ -73,10 +73,10 @@ | ||
| 73 | 73 |          $series = Series::whereTranslatable('slug', $this->property('series')) | 
| 74 | 74 | ->with( | 
| 75 | 75 | [ | 
| 76 | -                    'related_series' => static function ($query) { | |
| 76 | +                    'related_series' => static function($query) { | |
| 77 | 77 | $query->withCount( | 
| 78 | 78 | [ | 
| 79 | -                                'posts' => static function ($query) { | |
| 79 | +                                'posts' => static function($query) { | |
| 80 | 80 | $query->isPublished(); | 
| 81 | 81 | } | 
| 82 | 82 | ] |