Completed
Push — master ( 7f0061...a30fc0 )
by Gino
01:53
created
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
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         Schema::create(
70 70
             Tag::TABLE_NAME,
71
-            function ($table) {
71
+            function($table) {
72 72
                 $table->engine = 'InnoDB';
73 73
 
74 74
                 $table->increments('id');
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 
81 81
         Schema::create(
82 82
             Tag::CROSS_REFERENCE_TABLE_NAME,
83
-            function ($table) {
83
+            function($table) {
84 84
                 $table->engine = 'InnoDB';
85 85
 
86 86
                 $table->integer('tag_id')->unsigned()->nullable()->default(null);
87 87
                 $table->integer('post_id')->unsigned()->nullable()->default(null);
88
-                $table->index(['tag_id', 'post_id']);
88
+                $table->index([ 'tag_id', 'post_id' ]);
89 89
                 $table->foreign('tag_id', 'Tag reference')->references('id')->on(Tag::TABLE_NAME)->onDelete('cascade');
90 90
                 $table->foreign('post_id', 'Post reference')->references('id')->on('rainlab_blog_posts')->onDelete('cascade');
91 91
             }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     {
100 100
         Schema::create(
101 101
             Series::TABLE_NAME,
102
-            function ($table) {
102
+            function($table) {
103 103
                 $table->engine = 'InnoDB';
104 104
 
105 105
                 $table->increments('id');
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             }
111 111
         );
112 112
 
113
-        Schema::table('rainlab_blog_posts', function ($table) {
113
+        Schema::table('rainlab_blog_posts', function($table) {
114 114
             $table->integer(Series::TABLE_NAME . '_id')->unsigned()->nullable()->default(null);
115 115
             $table->foreign(Series::TABLE_NAME . '_id')->references('id')->on(Series::TABLE_NAME)->onDelete('cascade');
116 116
         });
Please login to merge, or discard this patch.
controllers/Tags.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function onBulkDelete()
56 56
     {
57
-        if (($checkedIds = (array)post('checked', []))) {
57
+        if (($checkedIds = (array)post('checked', [ ]))) {
58 58
             $delete = Tag::whereIn('id', $checkedIds)->delete();
59 59
         }
60 60
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     {
118 118
         $this->asExtension('FormController')->update(post('record_id'));
119 119
 
120
-        $this->vars['recordId'] = post('record_id');
120
+        $this->vars[ 'recordId' ] = post('record_id');
121 121
 
122 122
         return $this->makePartial('tag_update_modal_form');
123 123
     }
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,6 @@
 block discarded – undo
10 10
 use Backend\Behaviors\FormController;
11 11
 use Backend\Behaviors\ListController;
12 12
 use October\Rain\Exception\SystemException;
13
-use October\Rain\Flash\FlashBag;
14 13
 
15 14
 /**
16 15
  * Class Tags
Please login to merge, or discard this patch.
models/Tag.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     /**
32 32
      * @var array
33 33
      */
34
-    protected $slugs = ['slug' => 'name'];
34
+    protected $slugs = [ 'slug' => 'name' ];
35 35
 
36 36
     /**
37 37
      * Relations
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
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',
Please login to merge, or discard this patch.
Plugin.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /**
36 36
      * @var array   Require the RainLab.Blog plugin
37 37
      */
38
-    public $require = [self::REQUIRED_PLUGIN];
38
+    public $require = [ self::REQUIRED_PLUGIN ];
39 39
 
40 40
     /**
41 41
      * Returns information about this plugin
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     public function registerNavigation()
92 92
     {
93 93
         // Extend the navigation
94
-        Event::listen('backend.menu.extendItems', function ($manager) {
94
+        Event::listen('backend.menu.extendItems', function($manager) {
95 95
             $manager->addSideMenuItems(self::REQUIRED_PLUGIN, 'blog', [
96 96
                 'series' => [
97 97
                     'label' => self::LOCALIZATION_KEY . 'navigation.series',
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
      */
118 118
     private function extendModel()
119 119
     {
120
-        PostModel::extend(function ($model) {
121
-            $model->belongsToMany['tags'] = [
120
+        PostModel::extend(function($model) {
121
+            $model->belongsToMany[ 'tags' ] = [
122 122
                 Tag::class,
123 123
                 'table' => Tag::CROSS_REFERENCE_TABLE_NAME,
124 124
                 'order' => 'name'
125 125
             ];
126 126
 
127
-            $model->belongsTo['series'] = [
127
+            $model->belongsTo[ 'series' ] = [
128 128
                 Series::class,
129 129
                 'key' => Series::TABLE_NAME . "_id"
130 130
             ];
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     private function extendPostsController()
138 138
     {
139
-        PostsController::extendFormFields(function ($form, $model) {
139
+        PostsController::extendFormFields(function($form, $model) {
140 140
             if (!$model instanceof PostModel) {
141 141
                 return;
142 142
             }
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
             $tab = self::LOCALIZATION_KEY . 'navigation.taxonomy';
145 145
 
146 146
             $categoriesConfig = $form->getField('categories')->config;
147
-            $categoriesConfig['tab'] = $tab;
148
-            $categoriesConfig['mode'] = 'relation';
149
-            $categoriesConfig['type'] = 'taglist';
150
-            $categoriesConfig['label'] = 'Categories';
151
-            $categoriesConfig['comment'] = "rainlab.blog::lang.post.categories_comment";
152
-            $categoriesConfig['placeholder'] = self::LOCALIZATION_KEY . 'placeholders.tags';
153
-            unset($categoriesConfig['commentAbove']);
147
+            $categoriesConfig[ 'tab' ] = $tab;
148
+            $categoriesConfig[ 'mode' ] = 'relation';
149
+            $categoriesConfig[ 'type' ] = 'taglist';
150
+            $categoriesConfig[ 'label' ] = 'Categories';
151
+            $categoriesConfig[ 'comment' ] = "rainlab.blog::lang.post.categories_comment";
152
+            $categoriesConfig[ 'placeholder' ] = self::LOCALIZATION_KEY . 'placeholders.tags';
153
+            unset($categoriesConfig[ 'commentAbove' ]);
154 154
 
155 155
             $form->removeField('categories');
156 156
 
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
             ]);
181 181
         });
182 182
 
183
-        PostsController::extend(function (Controller $controller) {
184
-            $controller->implement[] = RelationController::class;
183
+        PostsController::extend(function(Controller $controller) {
184
+            $controller->implement[ ] = RelationController::class;
185 185
             $relationConfig = '$/' . self::DIRECTORY_KEY . '/controllers/series/config_posts_relation.yaml';
186 186
 
187 187
             if (property_exists($controller, 'relationConfig')) {
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
      */
201 201
     private function extendCategoriesController()
202 202
     {
203
-        CategoriesController::extend(function (Controller $controller) {
204
-            $controller->implement[] = RelationController::class;
203
+        CategoriesController::extend(function(Controller $controller) {
204
+            $controller->implement[ ] = RelationController::class;
205 205
             $relationConfig = '$/' . self::DIRECTORY_KEY . '/controllers/category/config_relation.yaml';
206 206
 
207 207
             if (property_exists($controller, 'relationConfig')) {
Please login to merge, or discard this patch.
components/RelatedPosts.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -121,8 +121,9 @@
 block discarded – undo
121 121
             ->first();
122 122
 
123 123
         // Abort if there is no source, or it has no tags
124
-        if (!$post || (!$tagIds = $post->tags->lists('id')))
125
-            return;
124
+        if (!$post || (!$tagIds = $post->tags->lists('id'))) {
125
+                    return;
126
+        }
126 127
 
127 128
         // Start building our query for related posts
128 129
         $query = Post::isPublished()
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     /**
20 20
      * @var Collection | array
21 21
      */
22
-    public $posts = [];
22
+    public $posts = [ ];
23 23
 
24 24
     /**
25 25
      * Reference to the page name for linking to posts
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 
131 131
     protected function prepareVars()
132 132
     {
133
-        $this->noPostsMessage = $this->page['noPostsMessage'] = $this->property('noPostsMessage');
134
-        $this->orderBy = $this->page['orderBy'] = $this->property('orderBy');
133
+        $this->noPostsMessage = $this->page[ 'noPostsMessage' ] = $this->property('noPostsMessage');
134
+        $this->orderBy = $this->page[ 'orderBy' ] = $this->property('orderBy');
135 135
 
136 136
         // Page links
137
-        $this->postPage = $this->page['postPage' ] = $this->property('postPage');
137
+        $this->postPage = $this->page[ 'postPage' ] = $this->property('postPage');
138 138
     }
139 139
 
140 140
     public function getPostPageOptions()
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             select count(*)
173 173
             from `ginopane_blogtaxonomy_post_tag`
174 174
             where `ginopane_blogtaxonomy_post_tag`.`post_id` = `rainlab_blog_posts`.`id`
175
-            and `ginopane_blogtaxonomy_post_tag`.`tag_id` in ('.implode(', ', $tagIds).')
175
+            and `ginopane_blogtaxonomy_post_tag`.`tag_id` in ('.implode(', ', $tagIds) . ')
176 176
         )');
177 177
 
178 178
         $key = $this->property('orderBy') ?: $subQuery;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $posts->each(
193 193
             function($post)
194 194
             {
195
-                $post->setUrl($this->postPage,$this->controller);
195
+                $post->setUrl($this->postPage, $this->controller);
196 196
             }
197 197
         );
198 198
 
Please login to merge, or discard this patch.
components/SeriesNavigation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
 
133 133
             $series->setUrl($this->seriesPage, $this->controller);
134 134
 
135
-            $series->posts->each(function ($post) {
135
+            $series->posts->each(function($post) {
136 136
                 $post->setUrl($this->postPage, $this->controller);
137 137
             });
138 138
         }
Please login to merge, or discard this patch.
components/TagList.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace GinoPane\BlogTaxonomy\Components;
4 4
 
5
-use DB;
6 5
 use Cms\Classes\Page;
7 6
 use Cms\Classes\ComponentBase;
8 7
 use GinoPane\BlogTaxonomy\Plugin;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * @var Collection | array
23 23
      */
24
-    public $tags = [];
24
+    public $tags = [ ];
25 25
 
26 26
     /**
27 27
      * Reference to the page name for linking to tags page
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $this->tagsPage = $this->property('tagsPage', '');
128 128
         $this->orderBy = $this->property('orderBy', 'name asc');
129 129
         $this->displayEmpty = $this->property('displayEmpty', false);
130
-        $this->limit =  $this->property('limit', 0);
130
+        $this->limit = $this->property('limit', 0);
131 131
 
132 132
         $this->tags = $this->listTags();
133 133
     }
Please login to merge, or discard this patch.
components/UrlHelperTrait.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
     /**
29 29
      * @param $items
30
-     * @param $urlPage
30
+     * @param string $urlPage
31 31
      * @param $controller
32 32
      */
33 33
     public function setUrls($items, $urlPage, $controller)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         $post->setUrl($this->postPage, $this->controller);
50 50
 
51 51
         if ($post && $post->categories->count()) {
52
-            $post->categories->each(function ($category) {
52
+            $post->categories->each(function($category) {
53 53
                 $category->setUrl($this->categoryPage, $this->controller);
54 54
             });
55 55
         }
Please login to merge, or discard this patch.
models/PostsRelationScopeTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
      *
19 19
      * @return mixed
20 20
      */
21
-    public function scopeListFrontend($query, array $options = [])
21
+    public function scopeListFrontend($query, array $options = [ ])
22 22
     {
23
-        if (in_array($options['sort'], array_keys(self::$sortingOptions))) {
24
-            if ($options['sort'] == 'random') {
23
+        if (in_array($options[ 'sort' ], array_keys(self::$sortingOptions))) {
24
+            if ($options[ 'sort' ] == 'random') {
25 25
                 $query->inRandomOrder();
26 26
             } else {
27
-                list($sortField, $sortDirection) = explode(' ', $options['sort']);
27
+                list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]);
28 28
 
29 29
                 if ($sortField == 'posts_count') {
30 30
                     $query->withCount('posts');
@@ -34,17 +34,17 @@  discard block
 block discarded – undo
34 34
             }
35 35
         }
36 36
 
37
-        if (empty($options['displayEmpty'])) {
37
+        if (empty($options[ 'displayEmpty' ])) {
38 38
             $query->has('posts');
39 39
         }
40 40
 
41 41
         // Limit the number of results
42
-        if (!empty($options['limit'])) {
43
-            $query->take($options['limit']);
42
+        if (!empty($options[ 'limit' ])) {
43
+            $query->take($options[ 'limit' ]);
44 44
         }
45 45
 
46 46
         return $query->with([
47
-                'posts' => function($query){
47
+                'posts' => function($query) {
48 48
                     $query->isPublished();
49 49
                 }
50 50
             ]
Please login to merge, or discard this patch.