Passed
Pull Request — 3.x (#1434)
by Harings
22:35 queued 08:34
created
src/Models/Behaviors/HasRevisions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function scopeMine($query)
24 24
     {
25
-        return $query->whereHas('revisions', function ($query) {
25
+        return $query->whereHas('revisions', function($query) {
26 26
             $query->where('user_id', auth('twill_users')->user()->id);
27 27
         });
28 28
     }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function revisionsArray()
36 36
     {
37
-        return $this->revisions->map(function ($revision) {
37
+        return $this->revisions->map(function($revision) {
38 38
             return [
39 39
                 'id' => $revision->id,
40 40
                 'author' => $revision->user->name ?? 'Unknown',
Please login to merge, or discard this patch.
src/Models/Behaviors/HasSlug.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 
12 12
     protected static function bootHasSlug()
13 13
     {
14
-        static::created(function ($model) {
14
+        static::created(function($model) {
15 15
             $model->setSlugs();
16 16
         });
17 17
 
18
-        static::updated(function ($model) {
18
+        static::updated(function($model) {
19 19
             $model->setSlugs();
20 20
         });
21 21
 
22
-        static::restored(function ($model) {
22
+        static::restored(function($model) {
23 23
             $model->setSlugs($restoring = true);
24 24
         });
25 25
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function scopeForSlug($query, $slug)
74 74
     {
75
-        return $query->whereHas('slugs', function ($query) use ($slug) {
75
+        return $query->whereHas('slugs', function($query) use ($slug) {
76 76
             $query->whereSlug($slug);
77 77
             $query->whereActive(true);
78 78
             $query->whereLocale(app()->getLocale());
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function scopeForInactiveSlug($query, $slug)
88 88
     {
89
-        return $query->whereHas('slugs', function ($query) use ($slug) {
89
+        return $query->whereHas('slugs', function($query) use ($slug) {
90 90
             $query->whereSlug($slug);
91 91
             $query->whereLocale(app()->getLocale());
92 92
         })->with(['slugs']);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function scopeForFallbackLocaleSlug($query, $slug)
101 101
     {
102
-        return $query->whereHas('slugs', function ($query) use ($slug) {
102
+        return $query->whereHas('slugs', function($query) use ($slug) {
103 103
             $query->whereSlug($slug);
104 104
             $query->whereActive(true);
105 105
             $query->whereLocale(config('translatable.fallback_locale'));
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         foreach ($slugParams as $key => $value) {
156 156
             //check variations of the slug
157 157
             if ($key == 'slug') {
158
-                $query->where(function ($query) use ($value) {
158
+                $query->where(function($query) use ($value) {
159 159
                     $query->orWhere('slug', $value);
160 160
                     $query->orWhere('slug', $value . '-' . $this->getSuffixSlug());
161 161
                     for ($i = 2; $i <= $this->nb_variation_slug; $i++) {
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function getActiveSlug($locale = null)
237 237
     {
238
-        return $this->slugs->first(function ($slug) use ($locale) {
238
+        return $this->slugs->first(function($slug) use ($locale) {
239 239
             return ($slug->locale === ($locale ?? app()->getLocale())) && $slug->active;
240 240
         }) ?? null;
241 241
     }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     public function getFallbackActiveSlug()
249 249
     {
250
-        return $this->slugs->first(function ($slug) {
250
+        return $this->slugs->first(function($slug) {
251 251
             return $slug->locale === config('translatable.fallback_locale') && $slug->active;
252 252
         }) ?? null;
253 253
     }
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleTags.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         if (!empty($ids)) {
58 58
             foreach ($ids as $id) {
59
-                $tagQuery->whereHas('tagged', function ($query) use ($id) {
59
+                $tagQuery->whereHas('tagged', function($query) use ($id) {
60 60
                     $query->where('taggable_id', $id);
61 61
                 });
62 62
             }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getTagsList()
72 72
     {
73
-        return $this->getTagsQuery()->where('count', '>', 0)->select('name', 'id')->get()->map(function ($tag) {
73
+        return $this->getTagsQuery()->where('count', '>', 0)->select('name', 'id')->get()->map(function($tag) {
74 74
             return [
75 75
                 'label' => $tag->name,
76 76
                 'value' => $tag->id,
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleRelatedBrowsers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
      */
67 67
     protected function getRelatedBrowsers()
68 68
     {
69
-        return collect($this->relatedBrowsers)->map(function ($browser, $key) {
69
+        return collect($this->relatedBrowsers)->map(function($browser, $key) {
70 70
             $browserName = is_string($browser) ? $browser : $key;
71 71
             $moduleName = !empty($browser['moduleName']) ? $browser['moduleName'] : $this->inferModuleNameFromBrowserName($browserName);
72 72
 
Please login to merge, or discard this patch.
src/Models/Model.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@
 block discarded – undo
42 42
     public function scopeVisible($query)
43 43
     {
44 44
         if ($this->isFillable('publish_start_date')) {
45
-            $query->where(function ($query) {
45
+            $query->where(function($query) {
46 46
                 $query->whereNull("{$this->getTable()}.publish_start_date")->orWhere("{$this->getTable()}.publish_start_date", '<=', Carbon::now());
47 47
             });
48 48
 
49 49
             if ($this->isFillable('publish_end_date')) {
50
-                $query->where(function ($query) {
50
+                $query->where(function($query) {
51 51
                     $query->whereNull("{$this->getTable()}.publish_end_date")->orWhere("{$this->getTable()}.publish_end_date", '>=', Carbon::now());
52 52
                 });
53 53
             }
Please login to merge, or discard this patch.
src/Models/Behaviors/HasTranslation.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         if (method_exists($query->getModel(), 'translations')) {
36 36
             $locale = $locale == null ? app()->getLocale() : $locale;
37 37
 
38
-            $query->whereHas('translations', function ($query) use ($locale) {
38
+            $query->whereHas('translations', function($query) use ($locale) {
39 39
                 $query->whereActive(true);
40 40
                 $query->whereLocale($locale);
41 41
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                 }
45 45
             });
46 46
 
47
-            return $query->with(['translations' => function ($query) use ($locale) {
47
+            return $query->with(['translations' => function($query) use ($locale) {
48 48
                 $query->whereActive(true);
49 49
                 $query->whereLocale($locale);
50 50
 
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
         $locale = $locale == null ? app()->getLocale() : $locale;
72 72
 
73 73
         return $query
74
-            ->join($translationTable, function (JoinClause $join) use ($translationTable, $localeKey, $table, $keyName) {
74
+            ->join($translationTable, function(JoinClause $join) use ($translationTable, $localeKey, $table, $keyName) {
75 75
                 $join
76
-                    ->on($translationTable.'.'.$this->getRelationKey(), '=', $table.'.'.$keyName)
77
-                    ->where($translationTable.'.'.$localeKey, $this->locale());
76
+                    ->on($translationTable . '.' . $this->getRelationKey(), '=', $table . '.' . $keyName)
77
+                    ->where($translationTable . '.' . $localeKey, $this->locale());
78 78
             })
79
-            ->where($translationTable.'.'.$this->getLocaleKey(), $locale)
80
-            ->orderBy($translationTable.'.'.$orderField, $orderType)
81
-            ->select($table.'.*')
79
+            ->where($translationTable . '.' . $this->getLocaleKey(), $locale)
80
+            ->orderBy($translationTable . '.' . $orderField, $orderType)
81
+            ->select($table . '.*')
82 82
             ->with('translations');
83 83
     }
84 84
 
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function getActiveLanguages()
132 132
     {
133
-        return $this->translations->map(function ($translation) {
133
+        return $this->translations->map(function($translation) {
134 134
             return [
135 135
                 'shortlabel' => strtoupper($translation->locale),
136 136
                 'label' => getLanguageLabelFromLocaleCode($translation->locale),
137 137
                 'value' => $translation->locale,
138 138
                 'published' => $translation->active ?? false,
139 139
             ];
140
-        })->sortBy(function ($translation) {
140
+        })->sortBy(function($translation) {
141 141
             $localesOrdered = getLocales();
142 142
             return array_search($translation['value'], $localesOrdered);
143 143
         })->values();
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function translatedAttribute($key)
153 153
     {
154
-        return $this->translations->mapWithKeys(function ($translation) use ($key) {
154
+        return $this->translations->mapWithKeys(function($translation) use ($key) {
155 155
             return [$translation->locale => $this->translate($translation->locale)->$key];
156 156
         });
157 157
     }
Please login to merge, or discard this patch.
src/Repositories/Behaviors/HandleBrowsers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $fields = $this->getRelatedElementsAsCollection($object, $relation);
153 153
 
154 154
         if ($fields->isNotEmpty()) {
155
-            return $fields->map(function ($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) {
155
+            return $fields->map(function($relatedElement) use ($titleKey, $routePrefix, $relation, $moduleName) {
156 156
                 return [
157 157
                     'id' => $relatedElement->id,
158 158
                     'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey,
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function getFormFieldsForRelatedBrowser($object, $relation, $titleKey = 'title')
176 176
     {
177
-        return $object->getRelated($relation)->map(function ($relatedElement) use ($titleKey) {
177
+        return $object->getRelated($relation)->map(function($relatedElement) use ($titleKey) {
178 178
             return ($relatedElement != null) ? [
179 179
                 'id' => $relatedElement->id,
180 180
                 'name' => $relatedElement->titleInBrowser ?? $relatedElement->$titleKey,
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             ]) + (classHasTrait($relatedElement, HasMedias::class) ? [
185 185
                 'thumbnail' => $relatedElement->defaultCmsImage(['w' => 100, 'h' => 100]),
186 186
             ] : []) : [];
187
-        })->reject(function ($item) {
187
+        })->reject(function($item) {
188 188
             return empty($item);
189 189
         })->values()->toArray();
190 190
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      */
198 198
     protected function getBrowsers()
199 199
     {
200
-        return collect($this->browsers)->map(function ($browser, $key) {
200
+        return collect($this->browsers)->map(function($browser, $key) {
201 201
             $browserName = is_string($browser) ? $browser : $key;
202 202
             $moduleName = !empty($browser['moduleName']) ? $browser['moduleName'] : $this->inferModuleNameFromBrowserName($browserName);
203 203
 
Please login to merge, or discard this patch.
src/Models/Behaviors/HasBlocks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,17 +19,17 @@
 block discarded – undo
19 19
     public function renderNamedBlocks($name = 'default', $renderChilds = true, $blockViewMappings = [], $data = [])
20 20
     {
21 21
         return $this->blocks
22
-            ->filter(function ($block) use ($name) {
22
+            ->filter(function($block) use ($name) {
23 23
                 return $name === 'default'
24 24
                 ? ($block->editor_name === $name || $block->editor_name === null)
25 25
                 : $block->editor_name === $name;
26 26
             })
27 27
             ->where('parent_id', null)
28
-            ->map(function ($block) use ($blockViewMappings, $renderChilds, $data) {
28
+            ->map(function($block) use ($blockViewMappings, $renderChilds, $data) {
29 29
                 if ($renderChilds) {
30 30
                     $childBlocks = $this->blocks->where('parent_id', $block->id);
31 31
 
32
-                    $renderedChildViews = $childBlocks->map(function ($childBlock) use ($blockViewMappings, $data) {
32
+                    $renderedChildViews = $childBlocks->map(function($childBlock) use ($blockViewMappings, $data) {
33 33
                         $view = $this->getBlockView($childBlock->type, $blockViewMappings);
34 34
                         return view($view, $data)->with('block', $childBlock)->render();
35 35
                     })->implode('');
Please login to merge, or discard this patch.
src/Models/Block.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@
 block discarded – undo
34 34
     public function scopeEditor($query, $name = 'default')
35 35
     {
36 36
         return $name === 'default' ?
37
-            $query->where('editor_name', $name)->orWhereNull('editor_name') :
38
-            $query->where('editor_name', $name);
37
+            $query->where('editor_name', $name)->orWhereNull('editor_name') : $query->where('editor_name', $name);
39 38
     }
40 39
 
41 40
     public function blockable()
Please login to merge, or discard this patch.