Test Setup Failed
Push — a-simpler-manager ( cc67c7...cc5aa5 )
by Ben
07:45
created
src/ManagedModels/Media/Application/FileFieldHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 {
15 15
     public function handle(HasAsset $model, MediaField $field, array $input, array $files): void
16 16
     {
17
-        foreach ([data_get($files, 'files.' . $field->getName(), []), data_get($input, 'files.' . $field->getName(), [])] as $requestPayload) {
17
+        foreach ([data_get($files, 'files.'.$field->getName(), []), data_get($input, 'files.'.$field->getName(), [])] as $requestPayload) {
18 18
             foreach ($requestPayload as $locale => $values) {
19 19
                 $this->handlePayload($model, $field, $locale, $values);
20 20
             }
Please login to merge, or discard this patch.
src/ManagedModels/Media/UploadMedia.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         if (is_string($file) && isset(json_decode($file)->output)) {
113 113
             $image_name = json_decode($file)->output->name;
114 114
             $asset = app(AddAsset::class)->add($model, json_decode($file)->output->image, $type, $locale, $this->sluggifyFilename($image_name));
115
-        } else {
115
+        }else {
116 116
             if ($file instanceof UploadedFile) {
117 117
                 $image_name = $file->getClientOriginalName();
118 118
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 if (false !== ($key = array_search($image_name, $files_order))) {
124 124
                     $files_order[$key] = (string)$asset->id;
125 125
                 }
126
-            } else {
126
+            }else {
127 127
                 $file = Asset::find($file);
128 128
                 if ($file) {
129 129
                     if ($model->assetRelation()->where('asset_pivots.type', $type)->where('asset_pivots.locale', $locale)->get()->contains($file)) {
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
      */
143 143
     private function sluggifyFilename($filename): string
144 144
     {
145
-        $extension = substr($filename, strrpos($filename, '.') + 1);
145
+        $extension = substr($filename, strrpos($filename, '.')+1);
146 146
         $filename = substr($filename, 0, strrpos($filename, '.'));
147
-        $filename = Str::slug($filename) . '.' . $extension;
147
+        $filename = Str::slug($filename).'.'.$extension;
148 148
 
149 149
         return $filename;
150 150
     }
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
                 if ($file instanceof UploadedFile && !$file->isValid()) {
161 161
                     if ($file->getError() == UPLOAD_ERR_INI_SIZE) {
162 162
                         throw new FileTooBigException(
163
-                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' .
164
-                            'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' .
165
-                            'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB'
163
+                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '.
164
+                            'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '.
165
+                            'post_max_size: '.(int)(ini_get('post_max_size')).'MB'
166 166
                         );
167 167
                     }
168 168
                 }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             foreach ($files as $locale => $_files) {
178 178
                 foreach ($_files as $action => $file) {
179 179
                     if (!in_array($action, $actions)) {
180
-                        throw new \InvalidArgumentException('A valid files entry should have a key of either [' . implode(',', $actions) . ']. Instead ' . $action . ' is given.');
180
+                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.');
181 181
                     }
182 182
                 }
183 183
             }
Please login to merge, or discard this patch.
src/ManagedModels/Application/SortModels.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         $params = [];
23 23
 
24 24
         foreach ($indices as $index => $modelId) {
25
-            $id = (int) $modelId;
25
+            $id = (int)$modelId;
26 26
             $cases[] = "WHEN {$id} then ?";
27 27
             $params[] = $index;
28 28
             $ids[] = $id;
Please login to merge, or discard this patch.
src/ManagedModels/Fields/Types/FileField.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     {
24 24
         return (new static(new FieldType(FieldType::FILE), $key))
25 25
             ->locales([config('app.fallback_locale', 'nl')])
26
-            ->valueResolver(function ($model = null, $locale = null, FileField $field) {
26
+            ->valueResolver(function($model = null, $locale = null, FileField $field) {
27 27
                 return $field->getMedia($model, $locale);
28 28
             });
29 29
     }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $files = [];
38 38
         $locale = $locale ?? app()->getLocale();
39 39
 
40
-        $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function ($asset) use ($locale) {
40
+        $assets = $model->assetRelation->where('pivot.type', $this->getKey())->filter(function($asset) use ($locale) {
41 41
             return $asset->pivot->locale == $locale;
42 42
         })->sortBy('pivot.order');
43 43
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             $thumbUrl = $asset->url('thumb');
48 48
 
49 49
             // If the conversions haven't run yet, we'll use the original image until they are uploaded
50
-            if(!file_exists(public_path($thumbUrl))) {
50
+            if (!file_exists(public_path($thumbUrl))) {
51 51
                 $thumbUrl = $asset->url();
52 52
             }
53 53
 
Please login to merge, or discard this patch.
src/ManagedModels/Fields/Types/AllowsTags.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
     public function tagged($tag): bool
10 10
     {
11
-        $tags = (array) $tag;
11
+        $tags = (array)$tag;
12 12
 
13 13
         return count(array_intersect($this->tags, $tags)) > 0;
14 14
     }
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function untag($tag)
29 29
     {
30
-        foreach((array) $tag as $_tag) {
31
-            if(false !== ($k = array_search($_tag, $this->tags))) {
30
+        foreach ((array)$tag as $_tag) {
31
+            if (false !== ($k = array_search($_tag, $this->tags))) {
32 32
                 unset($this->tags[$k]);
33 33
             }
34 34
         }
Please login to merge, or discard this patch.
src/Admin/HealthMonitor/Notifiers/ToastNotifier.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 {
11 11
     public function onFailure(HealthCheck $healthCheck)
12 12
     {
13
-        session()->now($this->generateUniqueSessionKey(), ['type' => 'warning', 'message' => $healthCheck->message() ]);
13
+        session()->now($this->generateUniqueSessionKey(), ['type' => 'warning', 'message' => $healthCheck->message()]);
14 14
     }
15 15
 
16 16
     public function onSuccess(HealthCheck $healthCheck)
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 
20 20
     private function generateUniqueSessionKey(): string
21 21
     {
22
-        $toastId = 'toast_messages.' . mt_rand(0, 9999);
22
+        $toastId = 'toast_messages.'.mt_rand(0, 9999);
23 23
 
24 24
         while (session()->get($toastId)) {
25
-            $toastId = 'toast_messages.' . mt_rand(0, 9999);
25
+            $toastId = 'toast_messages.'.mt_rand(0, 9999);
26 26
         }
27 27
 
28 28
         return $toastId;
Please login to merge, or discard this patch.
src/Admin/HealthMonitor/Monitor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
                     app($notifier)->onFailure($checkInstance);
34 34
                 }
35 35
                 break;
36
-            } else {
36
+            }else {
37 37
                 foreach ($notifiers as $notifier) {
38 38
                     app($notifier)->onSuccess($checkInstance);
39 39
                 }
Please login to merge, or discard this patch.
src/ManagedModels/States/Publishable/PreviewMode.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     public static function fromRequest()
19 19
     {
20
-        if(!config('chief.preview-mode') || Str::startsWith(request()->path(), 'admin/')) {
20
+        if (!config('chief.preview-mode') || Str::startsWith(request()->path(), 'admin/')) {
21 21
             return new static(false);
22 22
         }
23 23
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $mode = config('chief.preview-mode');
42 42
 
43
-        if(!$mode || $mode == 'live') return false;
43
+        if (!$mode || $mode == 'live') return false;
44 44
 
45 45
         return ($mode == 'preview');
46 46
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@
 block discarded – undo
40 40
     {
41 41
         $mode = config('chief.preview-mode');
42 42
 
43
-        if(!$mode || $mode == 'live') return false;
43
+        if(!$mode || $mode == 'live') {
44
+            return false;
45
+        }
44 46
 
45 47
         return ($mode == 'preview');
46 48
     }
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', 'fragment-status'])) {
35
+        if (!in_array($action, ['fragment-edit', 'fragment-update', 'fragment-delete', 'fragment-create', 'fragment-store', 'fragment-status'])) {
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', 'fragment-status']);
61
+        return in_array($action, ['fragment-edit', 'fragment-update', 'fragment-delete', 'fragment-create', 'fragment-store', 'fragment-status']);
62 62
     }
63 63
 
64 64
     public function fragmentCreate(Request $request, string $ownerKey, $ownerId)
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
         $model = $this->managedModelClass()::findOrFail($id);
160 160
 
161 161
         if ($request->get('deleteconfirmation') !== 'DELETE') {
162
-            return redirect()->back()->with('messages.warning', $model->adminLabel('title') . ' is niet verwijderd.');
162
+            return redirect()->back()->with('messages.warning', $model->adminLabel('title').' is niet verwijderd.');
163 163
         }
164 164
 
165 165
         app(DeleteModel::class)->handle($model);
166 166
 
167 167
         return redirect()->to($this->route('index'))
168
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "' . $model->adminLabel('title') . '" is verwijderd.');
168
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "'.$model->adminLabel('title').'" is verwijderd.');
169 169
     }
170 170
 
171 171
     private function owner(string $ownerKey, $ownerId): FragmentsOwner
Please login to merge, or discard this patch.