Completed
Push — master ( cfc96c...883ebd )
by Gino
03:17 queued 01:42
created
classes/ComponentAbstract.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
models/ModelAbstract.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             ]
Please login to merge, or discard this patch.
classes/PostListAbstract.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
models/Series.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
updates/create_taxonomies_tables.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
      */
54 54
     private function dropSeries()
55 55
     {
56
-        Schema::table('rainlab_blog_posts', function ($table) {
57
-            $table->dropForeign([Series::TABLE_NAME . '_id']);
56
+        Schema::table('rainlab_blog_posts', function($table) {
57
+            $table->dropForeign([ Series::TABLE_NAME . '_id' ]);
58 58
             $table->dropColumn(Series::TABLE_NAME . '_id');
59 59
         });
60 60
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         if (!Schema::hasTable(Tag::TABLE_NAME)) {
70 70
             Schema::create(
71 71
                 Tag::TABLE_NAME,
72
-                static function ($table) {
72
+                static function($table) {
73 73
                     $table->engine = 'InnoDB';
74 74
 
75 75
                     $table->increments('id');
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
         if (!Schema::hasTable(Tag::CROSS_REFERENCE_TABLE_NAME)) {
84 84
             Schema::create(
85 85
                 Tag::CROSS_REFERENCE_TABLE_NAME,
86
-                static function ($table) {
86
+                static function($table) {
87 87
                     $table->engine = 'InnoDB';
88 88
 
89 89
                     $table->integer('tag_id')->unsigned()->nullable()->default(null);
90 90
                     $table->integer('post_id')->unsigned()->nullable()->default(null);
91
-                    $table->index(['tag_id', 'post_id']);
91
+                    $table->index([ 'tag_id', 'post_id' ]);
92 92
                     $table->foreign('tag_id', 'Tag reference')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade');
93 93
                     $table->foreign('post_id', 'Post reference')->references('id')->on('rainlab_blog_posts')->onDelete('cascade');
94 94
                 }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         if (!Schema::hasTable(Series::TABLE_NAME)) {
105 105
             Schema::create(
106 106
                 Series::TABLE_NAME,
107
-                static function ($table) {
107
+                static function($table) {
108 108
                     $table->engine = 'InnoDB';
109 109
 
110 110
                     $table->increments('id');
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                 }
116 116
             );
117 117
 
118
-            Schema::table('rainlab_blog_posts', function ($table) {
118
+            Schema::table('rainlab_blog_posts', function($table) {
119 119
                 $table->integer(Series::TABLE_NAME . '_id')->unsigned()->nullable()->default(null);
120 120
                 $table->foreign(Series::TABLE_NAME . '_id')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade');
121 121
             });
Please login to merge, or discard this patch.
updates/create_related_series_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@
 block discarded – undo
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']);
58
+                    $table->index([ 'series_id', 'related_series_id' ]);
59 59
                     $table->foreign('series_id', 'Series reference')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade');
60 60
                     $table->foreign('related_series_id', 'Related series reference')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade');
61 61
                 }
Please login to merge, or discard this patch.
classes/migrationcommand/migrations/PkleindienstBlogSeriesMigration.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.