Test Setup Failed
Push — a-simpler-manager ( 66a756...9beba5 )
by Ben
05:42
created
src/Shared/helpers.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         $manifestPath = '/chief-assets/back';
21 21
 
22 22
         // Manifest expects each entry to start with a leading slash - we make sure to deduplicate the manifest path.
23
-        $entry = str_replace($manifestPath, '', '/' . ltrim($filepath, '/'));
23
+        $entry = str_replace($manifestPath, '', '/'.ltrim($filepath, '/'));
24 24
 
25 25
         try {
26 26
             // Paths should be given relative to the manifestpath so make sure to remove the basepath
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         } catch (\Exception $e) {
29 29
             \Illuminate\Support\Facades\Log::error($e);
30 30
 
31
-            return $manifestPath . $entry;
31
+            return $manifestPath.$entry;
32 32
         }
33 33
     }
34 34
 }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
         $teaser = mb_substr($text, 0, $max, 'utf-8');
118 118
 
119
-        return strlen($text) <= $max ? $teaser : $teaser . $ending;
119
+        return strlen($text) <= $max ? $teaser : $teaser.$ending;
120 120
     }
121 121
 }
122 122
 
@@ -247,16 +247,16 @@  discard block
 block discarded – undo
247 247
             'fragment',
248 248
         ], null), $parsed_url, $overrides);
249 249
 
250
-        $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'] . '://' : null;
251
-        $port = $parsed_url['port'] ? ':' . $parsed_url['port'] : null;
252
-        $fragment = $parsed_url['fragment'] ? '#' . $parsed_url['fragment'] : null;
250
+        $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'].'://' : null;
251
+        $port = $parsed_url['port'] ? ':'.$parsed_url['port'] : null;
252
+        $fragment = $parsed_url['fragment'] ? '#'.$parsed_url['fragment'] : null;
253 253
 
254
-        $baseurl = $scheme . $parsed_url['host'] . $port . $parsed_url['path'];
254
+        $baseurl = $scheme.$parsed_url['host'].$port.$parsed_url['path'];
255 255
         $current_query = [];
256 256
 
257 257
         $_query = explode('&', $parsed_url['query']);
258 258
 
259
-        array_map(function ($v) use (&$current_query) {
259
+        array_map(function($v) use (&$current_query) {
260 260
             if (!$v) {
261 261
                 return;
262 262
             }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
         $query = urldecode(http_build_query(array_merge($current_query, $query_params)));
276 276
 
277
-        return $baseurl . '?' . $query . $fragment;
277
+        return $baseurl.'?'.$query.$fragment;
278 278
     }
279 279
 }
280 280
 
Please login to merge, or discard this patch.
src/Admin/Nav/Nav.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function untagged(): self
32 32
     {
33
-        $filteredItems = array_filter($this->items, function(NavItem $navItem){
33
+        $filteredItems = array_filter($this->items, function(NavItem $navItem) {
34 34
             return $navItem->isUntagged();
35 35
         });
36 36
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     {
42 42
         $instance = new static();
43 43
 
44
-        foreach($navItems as $item) {
44
+        foreach ($navItems as $item) {
45 45
             $instance->add($item);
46 46
         }
47 47
 
Please login to merge, or discard this patch.
src/Managers/Assistants/FragmentsAssistant.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function routeFragmentsAssistant(string $action, $model = null, ...$parameters): ?string
27 27
     {
28
-        if(!in_array($action, ['fragments-index','fragments-reorder'])) return null;
28
+        if (!in_array($action, ['fragments-index', 'fragments-reorder'])) return null;
29 29
 
30 30
         return $this->generateRoute($action, $model, ...$parameters);
31 31
     }
32 32
 
33 33
     public function canFragmentsAssistant(string $action, $model = null): bool
34 34
     {
35
-        return in_array($action, ['fragments-index','fragments-reorder']);
35
+        return in_array($action, ['fragments-index', 'fragments-reorder']);
36 36
     }
37 37
 
38 38
     public function fragmentsIndex(Request $request, $id)
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $model = $modelClass::findOrFail($id);
44 44
 
45 45
         // Current fragments
46
-        $fragments = app(FragmentRepository::class)->getByOwner($model)->map(function(Fragmentable $model){
46
+        $fragments = app(FragmentRepository::class)->getByOwner($model)->map(function(Fragmentable $model) {
47 47
             return [
48 48
                 'model'    => $model,
49 49
                 'manager'  => app(Registry::class)->manager($model::managedModelKey()),
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         });
52 52
 
53 53
         // Available fragments
54
-        $allowedFragments = array_map(function($fragmentableClass){
54
+        $allowedFragments = array_map(function($fragmentableClass) {
55 55
             $modelClass = app(Registry::class)->modelClass($fragmentableClass::managedModelKey());
56 56
             return [
57 57
                 'manager' => app(Registry::class)->manager($fragmentableClass::managedModelKey()),
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@
 block discarded – undo
25 25
 
26 26
     public function routeFragmentsAssistant(string $action, $model = null, ...$parameters): ?string
27 27
     {
28
-        if(!in_array($action, ['fragments-index','fragments-reorder'])) return null;
28
+        if(!in_array($action, ['fragments-index','fragments-reorder'])) {
29
+            return null;
30
+        }
29 31
 
30 32
         return $this->generateRoute($action, $model, ...$parameters);
31 33
     }
Please login to merge, or discard this patch.
src/Managers/Assistants/FragmentAssistant.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function routeFragmentAssistant(string $action, $model = null, ...$parameters): ?string
34 34
     {
35
-        if(!in_array($action, ['fragment-edit','fragment-update','fragment-delete','fragment-create','fragment-store'])) {
35
+        if (!in_array($action, ['fragment-edit', 'fragment-update', 'fragment-delete', 'fragment-create', 'fragment-store'])) {
36 36
             return null;
37 37
         };
38 38
 
39 39
         $modelKey = $this->managedModelClass()::managedModelKey();
40 40
 
41
-        if(in_array($action, ['fragment-create', 'fragment-store'])) {
41
+        if (in_array($action, ['fragment-create', 'fragment-store'])) {
42 42
             if (!$model || !$model instanceof FragmentsOwner) {
43 43
                 throw new \Exception('Fragment route definition for '.$action.' requires the owning Model as second argument.');
44 44
             }
45 45
 
46
-            return route('chief.' . $modelKey . '.' . $action, array_merge([
46
+            return route('chief.'.$modelKey.'.'.$action, array_merge([
47 47
                 $model::managedModelKey(),
48 48
                 $model->modelReference()->id(),
49 49
             ], $parameters));
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
             throw new \Exception('Fragment route definition for '.$action.' requires the fragment model as second argument.');
54 54
         }
55 55
 
56
-        return route('chief.' . $modelKey . '.' . $action, $model->fragmentModel()->id);
56
+        return route('chief.'.$modelKey.'.'.$action, $model->fragmentModel()->id);
57 57
     }
58 58
 
59 59
     public function canFragmentAssistant(string $action, $model = null): bool
60 60
     {
61
-        return in_array($action, ['fragment-edit','fragment-update','fragment-delete','fragment-create','fragment-store']);
61
+        return in_array($action, ['fragment-edit', 'fragment-update', 'fragment-delete', 'fragment-create', 'fragment-store']);
62 62
     }
63 63
 
64 64
     public function fragmentCreate(Request $request, string $ownerKey, $ownerId)
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
         $model = $this->managedModelClass()::findOrFail($id);
146 146
 
147 147
         if ($request->get('deleteconfirmation') !== 'DELETE') {
148
-            return redirect()->back()->with('messages.warning', $model->adminLabel('title') . ' is niet verwijderd.');
148
+            return redirect()->back()->with('messages.warning', $model->adminLabel('title').' is niet verwijderd.');
149 149
         }
150 150
 
151 151
         app(DeleteManagedModel::class)->handle($model);
152 152
 
153 153
         return redirect()->to($this->route('index'))
154
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "' . $model->adminLabel('title') . '" is verwijderd.');
154
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "'.$model->adminLabel('title').'" is verwijderd.');
155 155
     }
156 156
 
157 157
     private function owner(string $ownerKey, $ownerId): FragmentsOwner
Please login to merge, or discard this patch.
src/Managers/Assistants/CrudAssistant.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
         // Default sorted by publish date
101 101
         $modelClass = $this->managedModelClass();
102 102
         if (Schema::hasColumn((new $modelClass)->getTable(), 'published_at')) {
103
-            $filters = $filters->add(HiddenFilter::make('publish', function ($query) {
103
+            $filters = $filters->add(HiddenFilter::make('publish', function($query) {
104 104
                 return $query->orderBy('published_at', 'DESC');
105 105
             }));
106 106
         }
107 107
 
108 108
         // if model has no timestamps, updated_at doesn't exist
109 109
         if ((new $modelClass)->timestamps) {
110
-            $filters = $filters->add(HiddenFilter::make('updated', function ($query) {
110
+            $filters = $filters->add(HiddenFilter::make('updated', function($query) {
111 111
                 return $query->orderBy('updated_at', 'DESC');
112 112
             }));
113 113
         }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $model->saveFields($model->fields()->tagged('create'), $request->all(), $request->allFiles());
142 142
 
143 143
         return redirect()->to($this->route('edit', $model))
144
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "' . $model->adminLabel('title') . '" is toegevoegd');
144
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "'.$model->adminLabel('title').'" is toegevoegd');
145 145
     }
146 146
 
147 147
     public function edit(Request $request, $id)
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         $model->saveFields($model->fields(), $request->all(), $request->allFiles());
173 173
 
174 174
         return redirect()->to($this->route('index'))
175
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  <a href="' . $this->route('edit', $model) . '">' . $model->adminLabel('title') . '</a> is aangepast');
175
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  <a href="'.$this->route('edit', $model).'">'.$model->adminLabel('title').'</a> is aangepast');
176 176
     }
177 177
 
178 178
     public function delete(Request $request, $id)
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
         $model = $this->managedModelClass()::findOrFail($id);
183 183
 
184 184
         if ($request->get('deleteconfirmation') !== 'DELETE') {
185
-            return redirect()->back()->with('messages.warning', $model->adminLabel('title') . ' is niet verwijderd.');
185
+            return redirect()->back()->with('messages.warning', $model->adminLabel('title').' is niet verwijderd.');
186 186
         }
187 187
 
188 188
         app(DeleteManagedModel::class)->handle($model);
189 189
 
190 190
         return redirect()->to($this->route('index'))
191
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "' . $model->adminLabel('title') . '" is verwijderd.');
191
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "'.$model->adminLabel('title').'" is verwijderd.');
192 192
     }
193 193
 }
Please login to merge, or discard this patch.