Completed
Push — master ( a30fc0...84b57d )
by Gino
01:44
created
components/SeriesNavigation.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace GinoPane\BlogTaxonomy\Components;
4 4
 
5 5
 use Cms\Classes\Page;
6
-use RainLab\Blog\Models\Post;
7 6
 use GinoPane\BlogTaxonomy\Plugin;
8 7
 use GinoPane\BlogTaxonomy\Models\Series;
9 8
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,8 +109,8 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
components/TagList.php 1 patch
Spacing   +3 added lines, -3 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
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $this->orderBy = $this->getProperty('orderBy');
151 151
         $this->postSlug = $this->property('postSlug');
152 152
         $this->displayEmpty = $this->getProperty('displayEmpty');
153
-        $this->limit =  $this->getProperty('limit');
153
+        $this->limit = $this->getProperty('limit');
154 154
 
155 155
         $this->tags = $this->listTags();
156 156
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
         $tagComponent = $this->getComponent(TagPosts::NAME, $this->tagsPage);
171 171
 
172
-        $this->setUrls($tags, $this->tagsPage, $this->controller, ['tag' => $this->urlProperty($tagComponent, 'tag')]);
172
+        $this->setUrls($tags, $this->tagsPage, $this->controller, [ 'tag' => $this->urlProperty($tagComponent, 'tag') ]);
173 173
 
174 174
         return $tags;
175 175
     }
Please login to merge, or discard this patch.
components/ComponentAbstract.php 1 patch
Spacing   +3 added lines, -3 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 ($blogCategoriesComponent) {
77
+                    $post->categories->each(function($category) use ($blogCategoriesComponent) {
78 78
                         /** @var Category $category */
79 79
                         $category->setUrl(
80 80
                             $this->categoryPage,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getProperty(string $property, $default = null)
115 115
     {
116
-        return $this->property($property, $this->defineProperties()[$property]['default'] ?? $default);
116
+        return $this->property($property, $this->defineProperties()[ $property ][ 'default' ] ?? $default);
117 117
     }
118 118
 
119 119
     /**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             $component = $page->getComponent($componentName);
132 132
         }
133 133
 
134
-        if (!empty($component) && is_callable([$this->controller, 'setComponentPropertiesFromParams'])) {
134
+        if (!empty($component) && is_callable([ $this->controller, 'setComponentPropertiesFromParams' ])) {
135 135
             $this->controller->setComponentPropertiesFromParams($component);
136 136
         }
137 137
 
Please login to merge, or discard this patch.
components/RelatedPosts.php 1 patch
Spacing   +4 added lines, -4 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
      * Reference to the page name for linking to posts
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
components/PostListAbstract.php 1 patch
Spacing   +5 added lines, -5 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 $posts = [];
24
+    public $posts = [ ];
25 25
 
26 26
     /**
27 27
      * @var integer             The current page
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
     {
149 149
         $this->currentPage = intval($this->property('page', 1)) ?: intval(post('page'));
150 150
         $this->resultsPerPage = intval($this->property('resultsPerPage'))
151
-            ?: $this->defineProperties()['resultsPerPage']['default'];
151
+            ?: $this->defineProperties()[ 'resultsPerPage' ][ 'default' ];
152 152
 
153
-        $this->orderBy = $this->page['orderBy'] = $this->property('orderBy');
153
+        $this->orderBy = $this->page[ 'orderBy' ] = $this->property('orderBy');
154 154
 
155 155
         // Page links
156
-        $this->postPage = $this->page['postPage' ] = $this->property('postPage');
157
-        $this->categoryPage = $this->page['categoryPage'] = $this->property('categoryPage');
156
+        $this->postPage = $this->page[ 'postPage' ] = $this->property('postPage');
157
+        $this->categoryPage = $this->page[ 'categoryPage' ] = $this->property('categoryPage');
158 158
     }
159 159
 
160 160
     /**
Please login to merge, or discard this patch.
Plugin.php 1 patch
Spacing   +15 added lines, -15 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_RAINLAB_BLOG];
38
+    public $require = [ self::REQUIRED_PLUGIN_RAINLAB_BLOG ];
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_RAINLAB_BLOG, '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'] = 'rainlab.blog::lang.post.tab_categories';
151
-            $categoriesConfig['comment'] = "rainlab.blog::lang.post.categories_comment";
152
-            $categoriesConfig['placeholder'] = self::LOCALIZATION_KEY . 'placeholders.categories';
153
-            unset($categoriesConfig['commentAbove']);
147
+            $categoriesConfig[ 'tab' ] = $tab;
148
+            $categoriesConfig[ 'mode' ] = 'relation';
149
+            $categoriesConfig[ 'type' ] = 'taglist';
150
+            $categoriesConfig[ 'label' ] = 'rainlab.blog::lang.post.tab_categories';
151
+            $categoriesConfig[ 'comment' ] = "rainlab.blog::lang.post.categories_comment";
152
+            $categoriesConfig[ 'placeholder' ] = self::LOCALIZATION_KEY . 'placeholders.categories';
153
+            unset($categoriesConfig[ 'commentAbove' ]);
154 154
 
155 155
             $form->removeField('categories');
156 156
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
      */
187 187
     private function extendCategoriesController()
188 188
     {
189
-        CategoriesController::extend(function (Controller $controller) {
190
-            $controller->implement[] = RelationController::class;
189
+        CategoriesController::extend(function(Controller $controller) {
190
+            $controller->implement[ ] = RelationController::class;
191 191
             $relationConfig = '$/' . self::DIRECTORY_KEY . '/controllers/category/config_relation.yaml';
192 192
 
193 193
             if (property_exists($controller, 'relationConfig')) {
Please login to merge, or discard this patch.
models/PostsRelationScopeTrait.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      *
21 21
      * @return mixed
22 22
      */
23
-    public function scopeListFrontend(Builder $query, array $options = [])
23
+    public function scopeListFrontend(Builder $query, array $options = [ ])
24 24
     {
25 25
         $this->withRelation($query);
26 26
 
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
      */
44 44
     private function queryDisplayEmpty(Builder $query, array $options): void
45 45
     {
46
-        if (empty($options['displayEmpty'])) {
46
+        if (empty($options[ 'displayEmpty' ])) {
47 47
             $query->withCount(
48 48
                 [
49
-                    'posts' => function ($query) {
49
+                    'posts' => function($query) {
50 50
                         $query->isPublished();
51 51
                     }
52 52
                 ]
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
      */
63 63
     private function queryPostSlug(Builder $query, array $options): void
64 64
     {
65
-        if (!empty($options['post'])) {
65
+        if (!empty($options[ 'post' ])) {
66 66
             $query->whereHas(
67 67
                 'posts',
68
-                function ($query) use ($options) {
69
-                    $query->whereSlug($options['post']);
68
+                function($query) use ($options) {
69
+                    $query->whereSlug($options[ 'post' ]);
70 70
                 }
71 71
             );
72 72
         }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
      */
81 81
     private function queryLimit(Builder $query, array $options): void
82 82
     {
83
-        if (!empty($options['limit'])) {
84
-            $query->take($options['limit']);
83
+        if (!empty($options[ 'limit' ])) {
84
+            $query->take($options[ 'limit' ]);
85 85
         }
86 86
     }
87 87
 
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
      */
94 94
     private function queryOrderBy(Builder $query, array $options): void
95 95
     {
96
-        if (in_array($options['sort'], array_keys(self::$sortingOptions))) {
97
-            if ($options['sort'] == 'random') {
96
+        if (in_array($options[ 'sort' ], array_keys(self::$sortingOptions))) {
97
+            if ($options[ 'sort' ] == 'random') {
98 98
                 $query->inRandomOrder();
99 99
             } else {
100
-                list($sortField, $sortDirection) = explode(' ', $options['sort']);
100
+                list($sortField, $sortDirection) = explode(' ', $options[ 'sort' ]);
101 101
 
102 102
                 if ($sortField == 'posts_count') {
103 103
                     $query->withCount(
104 104
                         [
105
-                            'posts' => function ($query) {
105
+                            'posts' => function($query) {
106 106
                                 $query->isPublished();
107 107
                             }
108 108
                         ]
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $query->with(
125 125
             [
126
-                'posts' => function ($query) {
126
+                'posts' => function($query) {
127 127
                     $query->isPublished();
128 128
                 }
129 129
             ]
Please login to merge, or discard this patch.