Passed
Push — ft/fields-refactor ( 34e13a...220f3b )
by Ben
81:47
created
src/Management/Details/Sections.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 
65 65
     public function __toString()
66 66
     {
67
-        return (string) $this->get('key');
67
+        return (string)$this->get('key');
68 68
     }
69 69
 
70 70
     /**
Please login to merge, or discard this patch.
src/PageBuilder/PresentSections.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             $this->addModelToCollection($i, $child);
79 79
         }
80 80
 
81
-        return $this->sets->values()->map(function (ViewableContract $child) {
81
+        return $this->sets->values()->map(function(ViewableContract $child) {
82 82
             return ($this->withSnippets && method_exists($child, 'withSnippets'))
83 83
                 ? $child->withSnippets()->setViewParent($this->parent)->renderView()
84 84
                 : $child->setViewParent($this->parent)->renderView();
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     {
96 96
         // Only published pages you fool!
97 97
         // TODO: check for assistant instead of method existence
98
-        if (method_exists($model, 'isPublished') && ! $model->isPublished()) {
98
+        if (method_exists($model, 'isPublished') && !$model->isPublished()) {
99 99
             return;
100 100
         }
101 101
 
Please login to merge, or discard this patch.
src/Pages/PageManager.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -87,11 +87,11 @@
 block discarded – undo
87 87
         return parent::fields()->add(
88 88
             $this->pageBuilderField(),
89 89
             InputField::make('title')->translatable($this->model->availableLocales())
90
-                                     ->validation('required-fallback-locale|max:200', [], [
91
-                                         'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title',
92
-                                     ])
93
-                                     ->label('De titel van je '.$this->model->labelSingular ?? 'pagina')
94
-                                     ->description('Dit is de titel die zal worden getoond in de overzichten en modules.'),
90
+                                        ->validation('required-fallback-locale|max:200', [], [
91
+                                            'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title',
92
+                                        ])
93
+                                        ->label('De titel van je '.$this->model->labelSingular ?? 'pagina')
94
+                                        ->description('Dit is de titel die zal worden getoond in de overzichten en modules.'),
95 95
             InputField::make('seo_title')
96 96
                 ->translatable($this->model->availableLocales())
97 97
                 ->label('Zoekmachine titel'),
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $permission = 'update-page';
63 63
 
64
-        if (in_array($verb, ['index','show'])) {
64
+        if (in_array($verb, ['index', 'show'])) {
65 65
             $permission = 'view-page';
66
-        } elseif (in_array($verb, ['create','store'])) {
66
+        } elseif (in_array($verb, ['create', 'store'])) {
67 67
             $permission = 'create-page';
68 68
         } elseif (in_array($verb, ['delete'])) {
69 69
             $permission = 'delete-page';
70 70
         }
71 71
 
72
-        if (! auth()->guard('chief')->user()->hasPermissionTo($permission)) {
72
+        if (!auth()->guard('chief')->user()->hasPermissionTo($permission)) {
73 73
             throw NotAllowedManagerRoute::notAllowedPermission($permission, $this);
74 74
         }
75 75
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     public function fieldArrangement($key = null): FieldArrangement
131 131
     {
132 132
         if ($key == 'create') {
133
-            return new FieldArrangement($this->fieldsWithAssistantFields()->filterBy(function ($field) {
133
+            return new FieldArrangement($this->fieldsWithAssistantFields()->filterBy(function($field) {
134 134
                 return in_array($field->key, ['title']);
135 135
             }));
136 136
         }
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
         if ($this->model->id) {
153 153
             return parent::details()
154 154
                 ->set('title', $this->model->title)
155
-                ->set('intro', 'Aangepast ' . $this->model->updated_at->format('d/m/Y H:i'))
156
-                ->set('context', '<span class="inline-s">' . $this->assistant('publish')->publicationStatusAsLabel() . '</span>');
155
+                ->set('intro', 'Aangepast '.$this->model->updated_at->format('d/m/Y H:i'))
156
+                ->set('context', '<span class="inline-s">'.$this->assistant('publish')->publicationStatusAsLabel().'</span>');
157 157
         }
158 158
 
159 159
         return parent::details();
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     public function saveFields(Request $request)
163 163
     {
164 164
         // Store the morph_key upon creation
165
-        if ($this->model instanceof MorphableContract && ! $this->model->morph_key) {
165
+        if ($this->model instanceof MorphableContract && !$this->model->morph_key) {
166 166
             $this->model->morph_key = $this->model->morphKey();
167 167
         }
168 168
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
             if (is_array_empty($translation)) {
208 208
 
209 209
                 // Nullify all values
210
-                $trans[$locale] = array_map(function ($value) {
210
+                $trans[$locale] = array_map(function($value) {
211 211
                     return null;
212 212
                 }, $translation);
213 213
                 continue;
Please login to merge, or discard this patch.
src/Sets/Set.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         // If no view has been created for this page collection, we try once again to fetch the content value if any. This will silently fail
48 48
         // if no content value is present. We don't consider the 'content' attribute to be a default as we do for module.
49
-        return $this->map(function ($item) {
49
+        return $this->map(function($item) {
50 50
             return ($this->viewParent && $item instanceof ViewableContract)
51 51
                 ? $item->setViewParent($this->viewParent)->renderView()
52 52
                 : ($item->content ?? '');
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         $currentPage = $currentPage ?? request()->get('page', 1);
81 81
         $path = request()->path();
82
-        $items = array_slice($this->all(), ($currentPage - 1) * $perPage);
82
+        $items = array_slice($this->all(), ($currentPage-1) * $perPage);
83 83
 
84 84
         return (new \Illuminate\Pagination\Paginator($items, $perPage, $currentPage))->setPath($path);
85 85
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         $currentPage = $currentPage ?? request()->get('page', 1);
98 98
         $path = request()->path();
99
-        $items = array_slice($this->all(), ($currentPage - 1) * $perPage, $perPage);
99
+        $items = array_slice($this->all(), ($currentPage-1) * $perPage, $perPage);
100 100
 
101 101
         return (new \Illuminate\Pagination\LengthAwarePaginator($items, $this->count(), $perPage, $currentPage))->setPath($path);
102 102
     }
Please login to merge, or discard this patch.
src/Urls/MemoizedUrlRecord.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
 {
9 9
     public static function findByModel(Model $model, string $locale = null): UrlRecord
10 10
     {
11
-        return chiefMemoize('url-records-find-by-model', function ($model, $locale = null) {
11
+        return chiefMemoize('url-records-find-by-model', function($model, $locale = null) {
12 12
             return parent::findByModel($model, $locale);
13 13
         }, [$model, $locale]);
14 14
     }
15 15
 
16 16
     public static function getByModel(Model $model)
17 17
     {
18
-        return chiefMemoize('url-records-get-by-model', function ($model) {
18
+        return chiefMemoize('url-records-get-by-model', function($model) {
19 19
             return parent::getByModel($model);
20 20
         }, [$model]);
21 21
     }
Please login to merge, or discard this patch.
src/Urls/ChiefResponse.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
                 return static::createRedirect($model->url($locale));
40 40
             }
41 41
 
42
-            if (method_exists($model, 'isPublished') && ! $model->isPublished()) {
42
+            if (method_exists($model, 'isPublished') && !$model->isPublished()) {
43 43
 
44 44
                 /** When admin is logged in and this request is in preview mode, we allow the view */
45
-                if (! PreviewMode::fromRequest()->check()) {
46
-                    throw new NotFoundHttpException('Model found for request ['. $slug .'] but it is not published.');
45
+                if (!PreviewMode::fromRequest()->check()) {
46
+                    throw new NotFoundHttpException('Model found for request ['.$slug.'] but it is not published.');
47 47
                 }
48 48
             }
49 49
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             }
55 55
         }
56 56
 
57
-        throw new NotFoundHttpException('No url or model found for request ['. $slug .'] for locale ['.$locale.'].');
57
+        throw new NotFoundHttpException('No url or model found for request ['.$slug.'] for locale ['.$locale.'].');
58 58
     }
59 59
 
60 60
     private static function createRedirect(string $url)
Please login to merge, or discard this patch.
src/Concerns/Viewable/Viewable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         // If no view has been created for this model, we try once again to fetch the content value if any. This will silently fail
38 38
         // if no content value is present. We consider the 'content' attribute to be a default for our copy.
39
-        return isset($this->content) ? (string) $this->content : '';
39
+        return isset($this->content) ? (string)$this->content : '';
40 40
     }
41 41
 
42 42
     public function setViewParent(ActsAsParent $parent): ViewableContract
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         }
65 65
 
66 66
         if (config('thinktomorrow.chief.strict')) {
67
-            throw new NotFoundViewKey('Missing view key. Please add a [viewKey] property to ' . get_class($this));
67
+            throw new NotFoundViewKey('Missing view key. Please add a [viewKey] property to '.get_class($this));
68 68
         };
69 69
 
70 70
         return '';
Please login to merge, or discard this patch.
src/Management/Assistants/AssistedManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function isAssistedBy(string $assistant): bool
19 19
     {
20
-        return !! $this->getAssistantClass($assistant);
20
+        return !!$this->getAssistantClass($assistant);
21 21
     }
22 22
 
23 23
     public function assistants(): array
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function assistant(string $assistant): Assistant
42 42
     {
43
-        if (! $this->isAssistedBy($assistant)) {
44
-            throw new MissingAssistant('No assistant [' . $assistant . '] present on manager ' . get_class($this));
43
+        if (!$this->isAssistedBy($assistant)) {
44
+            throw new MissingAssistant('No assistant ['.$assistant.'] present on manager '.get_class($this));
45 45
         }
46 46
 
47 47
         $instance = app($this->getAssistantClass($assistant));
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.