Completed
Push — master ( 318a17...6ffd9d )
by Gino
01:40
created
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.