Completed
Push — master ( dec10e...6c3469 )
by Gino
01:25
created
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.
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.
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.
models/ModelAbstract.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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, $options);
59 59
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     protected function queryDisplayEmpty(Builder $query, array $options)
105 105
     {
106
-        if (empty($options['displayEmpty'])) {
106
+        if (empty($options[ 'displayEmpty' ])) {
107 107
             $query
108 108
                 ->having('posts_count', '>', 0);
109 109
         }
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected function queryPostSlug(Builder $query, array $options)
119 119
     {
120
-        if (!empty($options['post'])) {
120
+        if (!empty($options[ 'post' ])) {
121 121
             $query->whereHas(
122 122
                 'posts',
123
-                static function ($query) use ($options) {
124
-                    ModelAbstract::whereTranslatableProperty($query, 'slug', $options['post']);
123
+                static function($query) use ($options) {
124
+                    ModelAbstract::whereTranslatableProperty($query, 'slug', $options[ 'post' ]);
125 125
                 }
126 126
             );
127 127
         }
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
      */
136 136
     private function queryLimit(Builder $query, array $options)
137 137
     {
138
-        if (!empty($options['limit'])) {
139
-            $query->take($options['limit']);
138
+        if (!empty($options[ 'limit' ])) {
139
+            $query->take($options[ 'limit' ]);
140 140
         }
141 141
     }
142 142
 
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function queryOrderBy(Builder $query, array $options)
150 150
     {
151
-        if (!empty($options['sort']) && \array_key_exists($options['sort'], static::$sortingOptions)) {
152
-            if ($options['sort'] === 'random') {
151
+        if (!empty($options[ 'sort' ]) && \array_key_exists($options[ 'sort' ], static::$sortingOptions)) {
152
+            if ($options[ 'sort' ] === 'random') {
153 153
                 $query->inRandomOrder();
154 154
             } else {
155
-                list($sortField, $sortDirection) = explode(' ', $options['sort']);
155
+                list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]);
156 156
 
157 157
                 $query->orderBy($sortField, $sortDirection);
158 158
             }
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
      */
168 168
     protected function withRelation(Builder $query, array $options)
169 169
     {
170
-        if (!empty($options['fetchPosts'])) {
170
+        if (!empty($options[ 'fetchPosts' ])) {
171 171
             $query->with(
172 172
                 [
173
-                    'posts' => static function (HasMany $query) use ($options) {
173
+                    'posts' => static function(HasMany $query) use ($options) {
174 174
                         $query->isPublished();
175 175
 
176 176
                         self::handleExceptions($query->getQuery(), $options);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
         $query->withCount(
183 183
             [
184
-                'posts' => static function ($query) use ($options) {
184
+                'posts' => static function($query) use ($options) {
185 185
                     $query->isPublished();
186 186
 
187 187
                     self::handleExceptions($query, $options);
@@ -204,16 +204,16 @@  discard block
 block discarded – undo
204 204
      */
205 205
     protected static function handleExceptions(Builder $query, array $options)
206 206
     {
207
-        if (!empty($options['includeCategories'])) {
208
-            PostListFiltersTrait::handleInclusionsByCategory($query, $options['includeCategories']);
207
+        if (!empty($options[ 'includeCategories' ])) {
208
+            PostListFiltersTrait::handleInclusionsByCategory($query, $options[ 'includeCategories' ]);
209 209
         }
210 210
 
211
-        if (!empty($options['exceptPosts'])) {
212
-            PostListFiltersTrait::handleExceptionsByPost($query, $options['exceptPosts']);
211
+        if (!empty($options[ 'exceptPosts' ])) {
212
+            PostListFiltersTrait::handleExceptionsByPost($query, $options[ 'exceptPosts' ]);
213 213
         }
214 214
 
215
-        if (!empty($options['exceptCategories'])) {
216
-            PostListFiltersTrait::handleExceptionsByCategory($query, $options['exceptCategories']);
215
+        if (!empty($options[ 'exceptCategories' ])) {
216
+            PostListFiltersTrait::handleExceptionsByCategory($query, $options[ 'exceptCategories' ]);
217 217
         }
218 218
     }
219 219
 }
Please login to merge, or discard this patch.
classes/PostListFiltersTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
     private static function separateParameters(array $parameters): array
109 109
     {
110 110
         $slugs = $parameters;
111
-        $ids = [];
111
+        $ids = [ ];
112 112
 
113 113
         foreach ($slugs as $index => $potentialId) {
114 114
             if (is_numeric($potentialId)) {
115
-                $ids[] = $potentialId;
116
-                unset($slugs[$index]);
115
+                $ids[ ] = $potentialId;
116
+                unset($slugs[ $index ]);
117 117
             }
118 118
         }
119 119
 
120
-        return [$ids, $slugs];
120
+        return [ $ids, $slugs ];
121 121
     }
122 122
 
123 123
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         if (!empty($exceptCategories)) {
130 130
             list($ids, $slugs) = self::separateParameters($exceptCategories);
131 131
 
132
-            $query->whereDoesntHave('categories', static function (Builder $innerQuery) use ($ids, $slugs) {
132
+            $query->whereDoesntHave('categories', static function(Builder $innerQuery) use ($ids, $slugs) {
133 133
                 if (!empty($ids)) {
134 134
                     $innerQuery->whereIn('id', $ids);
135 135
                 }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         if (!empty($includeCategories)) {
151 151
             list($ids, $slugs) = self::separateParameters($includeCategories);
152 152
 
153
-            $query->whereHas('categories', static function (Builder $innerQuery) use ($ids, $slugs) {
153
+            $query->whereHas('categories', static function(Builder $innerQuery) use ($ids, $slugs) {
154 154
                 if (!empty($ids)) {
155 155
                     $innerQuery->whereIn('id', $ids);
156 156
                 }
Please login to merge, or discard this patch.
updates/add_series_status_column.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->string('status')->default(Series::STATUS_ACTIVE);
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->dropColumn('status');
36 36
             });
37 37
         }
Please login to merge, or discard this patch.
controllers/Series.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $series = SeriesModel::whereId($recordId)->first();
58 58
 
59 59
         if ($series !== null) {
60
-            $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', ['series' => $series->title]);
60
+            $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', [ 'series' => $series->title ]);
61 61
         } else {
62 62
             $this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.series_does_not_exist');
63 63
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function onBulkDelete()
74 74
     {
75
-        if ($checkedIds = (array)post('checked', [])) {
75
+        if ($checkedIds = (array)post('checked', [ ])) {
76 76
             $delete = SeriesModel::whereIn('id', $checkedIds)->delete();
77 77
         }
78 78
 
Please login to merge, or discard this patch.