Test Failed
Push — ft/fields-refactor ( b1c0b9...6b3c14 )
by Ben
35:23
created
src/Management/Assistants/UrlAssistant.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function manager(Manager $manager)
25 25
     {
26
-        $this->manager  = $manager;
26
+        $this->manager = $manager;
27 27
 
28
-        if (! $manager->model() instanceof ProvidesUrl) {
29
-            throw new \Exception('UrlAssistant requires the model interfaced by ' . ProvidesUrl::class . '.');
28
+        if (!$manager->model() instanceof ProvidesUrl) {
29
+            throw new \Exception('UrlAssistant requires the model interfaced by '.ProvidesUrl::class.'.');
30 30
         }
31 31
 
32 32
         $this->model = $manager->model();
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
             InputField::make('url-slugs')
55 55
                 ->validation(
56 56
                     [
57
-                        'url-slugs' => ['array', 'min:1', new UniqueUrlSlugRule(($this->model && $this->model->exists) ? $this->model : null),],
57
+                        'url-slugs' => ['array', 'min:1', new UniqueUrlSlugRule(($this->model && $this->model->exists) ? $this->model : null), ],
58 58
                     ],
59 59
                     [],
60 60
                     [
61 61
                         'url-slugs.*' => 'taalspecifieke link',
62 62
                     ])
63 63
                 ->view('chief::back._fields.url-slugs')
64
-                ->viewData(['fields' => UrlSlugFields::fromModel($this->model) ]),
64
+                ->viewData(['fields' => UrlSlugFields::fromModel($this->model)]),
65 65
         ]);
66 66
     }
67 67
 
Please login to merge, or discard this patch.
src/Nav/Nav.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     public static function fromKeys($keys)
21 21
     {
22
-        $keys = (array) $keys;
22
+        $keys = (array)$keys;
23 23
         $collection = collect();
24 24
 
25 25
         /** @var Managers */
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
     public static function fromTags($tags)
35 35
     {
36
-        $tags = (array) $tags;
36
+        $tags = (array)$tags;
37 37
         $collection = collect();
38 38
 
39 39
         /** @var Managers */
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 
53 53
     private static function fromManagers(Collection $collection)
54 54
     {
55
-        return new static(...$collection->reject(function ($manager) {
55
+        return new static(...$collection->reject(function($manager) {
56 56
             return !$manager->can('index');
57
-        })->map(function ($manager) {
57
+        })->map(function($manager) {
58 58
             return new NavItem($manager->details()->plural, $manager->route('index'), [
59 59
                 'key' => $manager->details()->key,
60 60
                 'tags' => app(Register::class)->filterByKey($manager->details()->key)->first()->tags()
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
     public function rejectKeys($keys)
66 66
     {
67
-        $keys = (array) $keys;
67
+        $keys = (array)$keys;
68 68
 
69 69
         foreach ($this->items as $k => $item) {
70 70
             if (in_array($item->details('key', ''), $keys)) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     public function rejectTags($tags)
79 79
     {
80
-        $tags = (array) $tags;
80
+        $tags = (array)$tags;
81 81
 
82 82
         foreach ($this->items as $k => $item) {
83 83
             if (count(array_intersect($item->details('tags', []), $tags)) > 0) {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         $output = '';
120 120
 
121 121
         foreach ($this->items as $item) {
122
-            $output .= '<a class="' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="'.$item->url().'">';
122
+            $output .= '<a class="'.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">';
123 123
             $output .= $title ?? ucfirst($item->title());
124 124
             $output .= '</a>';
125 125
         }
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 
147 147
         $items = '';
148 148
         foreach ($this->items as $item) {
149
-            $items .= '<a class="' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="'.$item->url().'">';
149
+            $items .= '<a class="'.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">';
150 150
             $items .= $item->title();
151 151
             $items .= '</a>';
152 152
         }
153 153
 
154 154
         // Surround within vue dropdown
155 155
         $output = '<dropdown>';
156
-        $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'. ($title ?? 'Collecties') .'</span>';
156
+        $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'.($title ?? 'Collecties').'</span>';
157 157
         $output .= '<div v-cloak class="dropdown-box inset-s">';
158 158
         $output .= $items;
159 159
         $output .= '</div>';
Please login to merge, or discard this patch.
src/Filters/Filters.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function anyApplied(): bool
37 37
     {
38 38
         foreach ($this->all() as $filter) {
39
-            if(request()->filled($filter->name)) {
39
+            if (request()->filled($filter->name)) {
40 40
                 return true;
41 41
             }
42 42
         }
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $requestInput = request()->all();
50 50
 
51
-        return array_reduce($this->all(), function ($carry, Filter $filter) use ($requestInput) {
52
-            return $carry . $filter->render($requestInput);
51
+        return array_reduce($this->all(), function($carry, Filter $filter) use ($requestInput) {
52
+            return $carry.$filter->render($requestInput);
53 53
         }, '');
54 54
     }
55 55
 
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 
66 66
     public function keys(): array
67 67
     {
68
-        return array_map(function (Filter $filter) {
68
+        return array_map(function(Filter $filter) {
69 69
             return $filter->key();
70 70
         }, $this->filters);
71 71
     }
72 72
 
73 73
     private function validateFilters(array $filters)
74 74
     {
75
-        array_map(function (Filter $filter) {
75
+        array_map(function(Filter $filter) {
76 76
         }, $filters);
77 77
     }
78 78
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 
98 98
     public function offsetSet($offset, $value)
99 99
     {
100
-        if (! $value instanceof Filter) {
101
-            throw new \InvalidArgumentException('Passed value must be of type ' . Filter::class);
100
+        if (!$value instanceof Filter) {
101
+            throw new \InvalidArgumentException('Passed value must be of type '.Filter::class);
102 102
         }
103 103
 
104 104
         $this->filters[$offset] = $value;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
     private function sanitizeFilters(array $filters)
118 118
     {
119
-        return array_map(function ($filter) {
119
+        return array_map(function($filter) {
120 120
             if (is_string($filter) && class_exists($filter)) {
121 121
                 return $filter::init();
122 122
             }
Please login to merge, or discard this patch.
src/Concerns/Viewable/ViewPath.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function get(): string
36 36
     {
37
-        $basePath = $this->viewBasePath ? $this->viewBasePath . '.' : '';
37
+        $basePath = $this->viewBasePath ? $this->viewBasePath.'.' : '';
38 38
         $guessedParentViewName = $this->parent ? $this->parent->viewKey() : '';
39 39
         $guessedViewName = $this->viewable->viewKey();
40 40
 
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
         }
54 54
 
55 55
         foreach ($viewPaths as $viewPath) {
56
-            if (! view()->exists($viewPath)) {
56
+            if (!view()->exists($viewPath)) {
57 57
                 continue;
58 58
             }
59 59
 
60 60
             return $viewPath;
61 61
         }
62 62
 
63
-        if (! view()->exists($basePath.'show')){
63
+        if (!view()->exists($basePath.'show')) {
64 64
             throw new NotFoundView('Viewfile not found for ['.get_class($this->viewable).']. Make sure the default view ['.$basePath.'show] exists.');
65 65
         }
66 66
     }
Please login to merge, or discard this patch.
src/Urls/UrlSlugField.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@
 block discarded – undo
39 39
 
40 40
         // If this is a '/' slug, it indicates the homepage for this locale. In this case,
41 41
         // we wont be trimming the slash
42
-        if($slug === '/') return $slug;
42
+        if($slug === '/') {
43
+            return $slug;
44
+        }
43 45
 
44 46
         if ($this->startsWithBaseUrlSegment($slug)) {
45 47
             $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/');
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
         // If this is a '/' slug, it indicates the homepage for this locale. In this case,
51 51
         // we wont be trimming the slash
52
-        if($slug === '/') return $slug;
52
+        if ($slug === '/') return $slug;
53 53
 
54 54
         if ($this->startsWithBaseUrlSegment($slug)) {
55 55
             $slug = trim(substr($slug, strlen($this->baseUrlSegment)), '/');
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             'baseUrlSegment' => $this->baseUrlSegment,
80 80
             'hint' => null, // Hint placeholder to show url hint when it already exists
81 81
             'is_homepage' => ($this->value() === '/'),
82
-            'show' => !!$this->value(),// show input field or not
82
+            'show' => !!$this->value(), // show input field or not
83 83
         ]);
84 84
     }
85 85
 }
Please login to merge, or discard this patch.
src/Management/Registration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,12 +83,12 @@
 block discarded – undo
83 83
         }
84 84
 
85 85
         $manager = new \ReflectionClass($managerClass);
86
-        if (! $manager->implementsInterface(Manager::class)) {
86
+        if (!$manager->implementsInterface(Manager::class)) {
87 87
             throw new \InvalidArgumentException('Class ['.$managerClass.'] is expected to implement the ['.Manager::class.'] contract.');
88 88
         }
89 89
 
90 90
         $model = new \ReflectionClass($modelClass);
91
-        if (! $model->implementsInterface(ManagedModel::class)) {
91
+        if (!$model->implementsInterface(ManagedModel::class)) {
92 92
             throw new \InvalidArgumentException('Class ['.$modelClass.'] is expected to implement the ['.ManagedModel::class.'] contract.');
93 93
         }
94 94
     }
Please login to merge, or discard this patch.
src/Urls/UrlSlugFields.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     public static function redirectsFromModel(ProvidesUrl $model)
20 20
     {
21
-        $records = MemoizedUrlRecord::getByModel($model)->reject(function ($record) {
21
+        $records = MemoizedUrlRecord::getByModel($model)->reject(function($record) {
22 22
             return !$record->isRedirect();
23 23
         })->sortByDesc('created_at');
24 24
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             $fields[$key] = UrlSlugField::make($key)
30 30
                 ->setUrlRecord($record)
31 31
                 ->setBaseUrlSegment($model->baseUrlSegment($record->locale))
32
-                ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) . '/');
32
+                ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/');
33 33
         }
34 34
 
35 35
         return $fields;
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
         $fields = new static([]);
62 62
 
63 63
         foreach ($locales as $locale) {
64
-            $fields['url-slugs.' . $locale] = UrlSlugField::make('url-slugs.' . $locale)
64
+            $fields['url-slugs.'.$locale] = UrlSlugField::make('url-slugs.'.$locale)
65 65
                                                 ->setBaseUrlSegment($model->baseUrlSegment($locale))
66
-                                                ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)) .'/')
67
-                                                ->name('url-slugs[' . $locale . ']')
66
+                                                ->prepend($model->resolveUrl($locale, $model->baseUrlSegment($locale)).'/')
67
+                                                ->name('url-slugs['.$locale.']')
68 68
                                                 ->label($locale);
69 69
         }
70 70
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     private static function fillWithExistingValues(ProvidesUrl $model, self $fields): void
79 79
     {
80
-        $records = MemoizedUrlRecord::getByModel($model)->reject(function ($record) {
80
+        $records = MemoizedUrlRecord::getByModel($model)->reject(function($record) {
81 81
             return $record->isRedirect();
82 82
         })->sortBy('locale');
83 83
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $fields['url-slugs.'.$record->locale]
90 90
                 ->setUrlRecord($record)
91 91
                 ->setBaseUrlSegment($model->baseUrlSegment($record->locale))
92
-                ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)) .'/');
92
+                ->prepend($model->resolveUrl($record->locale, $model->baseUrlSegment($record->locale)).'/');
93 93
         }
94 94
     }
95 95
 }
Please login to merge, or discard this patch.
src/Fields/Fields.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 
124 124
     public function offsetSet($offset, $value)
125 125
     {
126
-        if (! $value instanceof Field) {
127
-            throw new \InvalidArgumentException('Passed value must be of type ' . Field::class);
126
+        if (!$value instanceof Field) {
127
+            throw new \InvalidArgumentException('Passed value must be of type '.Field::class);
128 128
         }
129 129
 
130 130
         $this->fields[$offset] = $value;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
     private function validateFields(array $fields)
155 155
     {
156
-        array_map(function (Field $field) {
156
+        array_map(function(Field $field) {
157 157
         }, $fields);
158 158
     }
159 159
 
Please login to merge, or discard this patch.
src/Modules/ModuleManager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $permission = 'update-page';
65 65
 
66
-        if (in_array($verb, ['index','show'])) {
66
+        if (in_array($verb, ['index', 'show'])) {
67 67
             $permission = 'view-page';
68
-        } elseif (in_array($verb, ['create','store'])) {
68
+        } elseif (in_array($verb, ['create', 'store'])) {
69 69
             $permission = 'create-page';
70 70
         } elseif (in_array($verb, ['delete'])) {
71 71
             $permission = 'delete-page';
72 72
         }
73 73
 
74
-        if (! auth()->guard('chief')->user()->hasPermissionTo($permission)) {
74
+        if (!auth()->guard('chief')->user()->hasPermissionTo($permission)) {
75 75
             throw NotAllowedManagerRoute::notAllowedPermission($permission, $this);
76 76
         }
77 77
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     public function saveFields(Request $request)
104 104
     {
105 105
         // Store the morph_key upon creation
106
-        if (! $this->model->morph_key) {
106
+        if (!$this->model->morph_key) {
107 107
             $this->model->morph_key = $this->model->morphKey();
108 108
         }
109 109
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             if (is_array_empty($translation)) {
143 143
 
144 144
                 // Nullify all values
145
-                $trans[$locale] = array_map(function ($value) {
145
+                $trans[$locale] = array_map(function($value) {
146 146
                     return null;
147 147
                 }, $translation);
148 148
                 continue;
Please login to merge, or discard this patch.