Completed
Pull Request — master (#63)
by Gino
01:31
created
components/TagList.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * @var Collection | array
27 27
      */
28
-    public $tags = [];
28
+    public $tags = [ ];
29 29
 
30 30
     /**
31 31
      * Reference to the page name for linking to tag page
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
         $this->tagsPageUrl = $this->controller->pageUrl($this->tagsPage);
366 366
 
367
-        $this->setUrls($tags, $this->tagPage, $this->controller, ['tag' => $this->urlProperty($tagComponent, 'tag')]);
367
+        $this->setUrls($tags, $this->tagPage, $this->controller, [ 'tag' => $this->urlProperty($tagComponent, 'tag') ]);
368 368
     }
369 369
 
370 370
     /**
@@ -406,18 +406,18 @@  discard block
 block discarded – undo
406 406
 
407 407
     private function prepareVars()
408 408
     {
409
-        $this->tagPage = (string) $this->getProperty('tagPage');
410
-        $this->tagsPage = (string) $this->getProperty('tagsPage');
409
+        $this->tagPage = (string)$this->getProperty('tagPage');
410
+        $this->tagsPage = (string)$this->getProperty('tagsPage');
411 411
 
412 412
         $this->orderBy = $this->getProperty('orderBy');
413 413
         $this->postSlug = $this->getProperty('postSlug');
414
-        $this->fetchPosts = (bool) $this->getProperty('fetchPosts');
415
-        $this->displayEmpty = (bool) $this->getProperty('displayEmpty');
416
-        $this->limit = (int) $this->getProperty('limit');
417
-        $this->exposeTotalCount = (bool) $this->getProperty('exposeTotalCount');
418
-        $this->enableTagFilter = (string) $this->getProperty('enableTagFilter');
419
-        $this->includeSeriesTags = (bool) $this->getProperty('includeSeriesTags');
420
-        $this->fetchSeriesPostCount = (bool) $this->getProperty('fetchSeriesPostCount');
421
-        $this->debugOutput = (bool) $this->getProperty('debugOutput');
414
+        $this->fetchPosts = (bool)$this->getProperty('fetchPosts');
415
+        $this->displayEmpty = (bool)$this->getProperty('displayEmpty');
416
+        $this->limit = (int)$this->getProperty('limit');
417
+        $this->exposeTotalCount = (bool)$this->getProperty('exposeTotalCount');
418
+        $this->enableTagFilter = (string)$this->getProperty('enableTagFilter');
419
+        $this->includeSeriesTags = (bool)$this->getProperty('includeSeriesTags');
420
+        $this->fetchSeriesPostCount = (bool)$this->getProperty('fetchSeriesPostCount');
421
+        $this->debugOutput = (bool)$this->getProperty('debugOutput');
422 422
     }
423 423
 }
Please login to merge, or discard this patch.
components/TagPosts.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@
 block discarded – undo
87 87
      */
88 88
     protected function getPostsQuery()
89 89
     {
90
-        $query = Post::whereHas('tags', function ($query) {
90
+        $query = Post::whereHas('tags', function($query) {
91 91
             $query->whereTranslatable('slug', $this->tag->slug);
92 92
         });
93 93
 
94 94
         if ($this->includeSeriesPosts) {
95
-            $query->orWhereHas('series', function ($query) {
96
-                $query->whereHas('tags', function ($query) {
95
+            $query->orWhereHas('series', function($query) {
96
+                $query->whereHas('tags', function($query) {
97 97
                     $query->whereTranslatable('slug', $this->tag->slug);
98 98
                 });
99 99
             });
Please login to merge, or discard this patch.
controllers/Tags.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function onBulkDelete()
57 57
     {
58
-        if ($checkedIds = (array)post('checked', [])) {
58
+        if ($checkedIds = (array)post('checked', [ ])) {
59 59
             $delete = Tag::whereIn('id', $checkedIds)->delete();
60 60
         }
61 61
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function index_onRemoveOrphanedTags()
79 79
     {
80
-        if (!Tag::has('posts', 0)->has('series', 0)->count() ) {
80
+        if (!Tag::has('posts', 0)->has('series', 0)->count()) {
81 81
             Flash::warning(e(trans(Plugin::LOCALIZATION_KEY . 'form.tags.no_orphaned_tags')));
82 82
 
83 83
             return;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $tag = Tag::whereId($recordId)->first();
109 109
 
110 110
         if ($tag !== null) {
111
-            $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.tags.edit_title', ['tag' => $tag->name]);
111
+            $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.tags.edit_title', [ 'tag' => $tag->name ]);
112 112
         } else {
113 113
             $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.tags.tag_does_not_exist');
114 114
         }
Please login to merge, or discard this patch.
controllers/Series.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         $series = SeriesModel::whereId($recordId)->first();
57 57
 
58 58
         if ($series !== null) {
59
-            $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', ['series' => $series->title]);
59
+            $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', [ 'series' => $series->title ]);
60 60
         } else {
61 61
             $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.series_does_not_exist');
62 62
         }
Please login to merge, or discard this patch.
Plugin.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     public function registerNavigation()
105 105
     {
106 106
         // Extend the navigation
107
-        Event::listen('backend.menu.extendItems', function ($manager) {
107
+        Event::listen('backend.menu.extendItems', function($manager) {
108 108
             $manager->addSideMenuItems(self::REQUIRED_PLUGIN_RAINLAB_BLOG, 'blog', [
109 109
                 'series' => [
110 110
                     'label' => self::LOCALIZATION_KEY . 'navigation.series',
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
      */
131 131
     private function extendModel()
132 132
     {
133
-        PostModel::extend(function ($model) {
133
+        PostModel::extend(function($model) {
134 134
             $model->morphToMany = [
135
-                'tags' => [Tag::class, 'name' => Tag::PIVOT_COLUMN]
135
+                'tags' => [ Tag::class, 'name' => Tag::PIVOT_COLUMN ]
136 136
             ];
137 137
 
138
-            $model->belongsTo['series'] = [
138
+            $model->belongsTo[ 'series' ] = [
139 139
                 Series::class,
140 140
                 'key' => Series::TABLE_NAME . "_id"
141 141
             ];
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     private function extendPostsController()
149 149
     {
150
-        PostsController::extendFormFields(function ($form, $model) {
150
+        PostsController::extendFormFields(function($form, $model) {
151 151
             if (!$model instanceof PostModel) {
152 152
                 return;
153 153
             }
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
             $tab = self::LOCALIZATION_KEY . 'navigation.taxonomy';
167 167
 
168 168
             $categoriesConfig = $form->getField('categories')->config;
169
-            $categoriesConfig['tab'] = $tab;
170
-            $categoriesConfig['mode'] = 'relation';
171
-            $categoriesConfig['type'] = 'taglist';
172
-            $categoriesConfig['label'] = 'rainlab.blog::lang.post.tab_categories';
173
-            $categoriesConfig['comment'] = "rainlab.blog::lang.post.categories_comment";
174
-            $categoriesConfig['placeholder'] = self::LOCALIZATION_KEY . 'placeholders.categories';
175
-            unset($categoriesConfig['commentAbove']);
169
+            $categoriesConfig[ 'tab' ] = $tab;
170
+            $categoriesConfig[ 'mode' ] = 'relation';
171
+            $categoriesConfig[ 'type' ] = 'taglist';
172
+            $categoriesConfig[ 'label' ] = 'rainlab.blog::lang.post.tab_categories';
173
+            $categoriesConfig[ 'comment' ] = "rainlab.blog::lang.post.categories_comment";
174
+            $categoriesConfig[ 'placeholder' ] = self::LOCALIZATION_KEY . 'placeholders.categories';
175
+            unset($categoriesConfig[ 'commentAbove' ]);
176 176
 
177 177
             $form->removeField('categories');
178 178
 
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
      */
207 207
     private function extendCategoriesController()
208 208
     {
209
-        CategoriesController::extend(function (Controller $controller) {
210
-            $controller->implement[] = RelationController::class;
209
+        CategoriesController::extend(function(Controller $controller) {
210
+            $controller->implement[ ] = RelationController::class;
211 211
             $relationConfig = '$/' . self::DIRECTORY_KEY . '/controllers/category/config_relation.yaml';
212 212
 
213 213
             if (property_exists($controller, 'relationConfig')) {
Please login to merge, or discard this patch.
updates/create_polymorphic_tag_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
             Schema::create(
57 57
                 Tag::PIVOT_TABLE,
58
-                static function ($table) use ($pivotColumnId, $pivotColumnType) {
58
+                static function($table) use ($pivotColumnId, $pivotColumnType) {
59 59
                     $table->engine = 'InnoDB';
60 60
 
61 61
                     $table->integer('tag_id')->unsigned()->nullable()->default(null);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                     $table->string($pivotColumnType);
64 64
 
65 65
                     $table->index(
66
-                        ['tag_id', Tag::PIVOT_COLUMN . '_id', Tag::PIVOT_COLUMN . '_type'],
66
+                        [ 'tag_id', Tag::PIVOT_COLUMN . '_id', Tag::PIVOT_COLUMN . '_type' ],
67 67
                         'ginopane_blogtaxonomy_taggable_index'
68 68
                     );
69 69
 
Please login to merge, or discard this patch.
models/Tag.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
updates/change_description_field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function up()
20 20
     {
21 21
         if (Schema::hasTable(Series::TABLE_NAME)) {
22
-            Schema::table(Series::TABLE_NAME, static function ($table) {
22
+            Schema::table(Series::TABLE_NAME, static function($table) {
23 23
                 $table->text('description')->nullable()->change();
24 24
             });
25 25
         }
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function down()
32 32
     {
33 33
         if (Schema::hasTable(Series::TABLE_NAME)) {
34
-            Schema::table(Series::TABLE_NAME, static function ($table) {
34
+            Schema::table(Series::TABLE_NAME, static function($table) {
35 35
                 $table->string('description')->nullable()->change();
36 36
             });
37 37
         }
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', static function ($table) {
57
-            $table->dropForeign([Series::TABLE_NAME . '_id']);
56
+        Schema::table('rainlab_blog_posts', static 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')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade');
93 93
                     $table->foreign('post_id')->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.