Test Setup Failed
Push — a-simpler-manager ( 29c609...36222e )
by Ben
08:49 queued 01:34
created
src/OLD/Fragments/FragmentField.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -63,22 +63,22 @@
 block discarded – undo
63 63
                 ->setModelIdInputName($this->name . '[' . $k . '][modelId]')
64 64
                 ->setFields($this->fields->clone()->map(function (Field $field) use ($k, $fragment) {
65 65
                     return $field->name($this->name . '.' . $k . '.' . $field->getName())
66
-                                 ->localizedFormat(':name.:locale')
67
-                                 ->valueResolver(function ($model = null, $locale = null, $field) use ($fragment) {
68
-                                     if (isset($field->value)) {
69
-                                         return $field->value;
70
-                                     }
71
-
72
-                                     if ($field instanceof MediaField) {
73
-                                         if (!$fragment->hasModelId()) {
74
-                                             return [];
75
-                                         }
76
-
77
-                                         return $field->getMedia(FragmentModel::find($fragment->getModelId()), $locale);
78
-                                     }
79
-
80
-                                     return $fragment->getValue($field->getColumn(), $locale);
81
-                                 });
66
+                                    ->localizedFormat(':name.:locale')
67
+                                    ->valueResolver(function ($model = null, $locale = null, $field) use ($fragment) {
68
+                                        if (isset($field->value)) {
69
+                                            return $field->value;
70
+                                        }
71
+
72
+                                        if ($field instanceof MediaField) {
73
+                                            if (!$fragment->hasModelId()) {
74
+                                                return [];
75
+                                            }
76
+
77
+                                            return $field->getMedia(FragmentModel::find($fragment->getModelId()), $locale);
78
+                                        }
79
+
80
+                                        return $fragment->getValue($field->getColumn(), $locale);
81
+                                    });
82 82
                 }));
83 83
         }
84 84
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
         // Model is auto-injected by Manager::editFields() method.
49 49
         if (($this->model)) {
50 50
             if (!method_exists($this->model, 'getFragments')) {
51
-                throw new \RuntimeException(get_class($this->model) . ' is missing the ' . HasFragments::class . ' trait.');
51
+                throw new \RuntimeException(get_class($this->model).' is missing the '.HasFragments::class.' trait.');
52 52
             }
53 53
 
54 54
             if (count($modelFragments = $this->model->getFragments($this->getKey())) > 0) {
55
-                $fragments = $modelFragments->map(function (FragmentModel $fragmentModel) {
55
+                $fragments = $modelFragments->map(function(FragmentModel $fragmentModel) {
56 56
                     return Fragment::fromModel($fragmentModel);
57 57
                 })->all();
58 58
             }
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
 
61 61
         foreach ($fragments as $k => $fragment) {
62 62
             $fragments[$k] = $fragments[$k]
63
-                ->setModelIdInputName($this->name . '[' . $k . '][modelId]')
64
-                ->setFields($this->fields->clone()->map(function (Field $field) use ($k, $fragment) {
65
-                    return $field->name($this->name . '.' . $k . '.' . $field->getName())
63
+                ->setModelIdInputName($this->name.'['.$k.'][modelId]')
64
+                ->setFields($this->fields->clone()->map(function(Field $field) use ($k, $fragment) {
65
+                    return $field->name($this->name.'.'.$k.'.'.$field->getName())
66 66
                                  ->localizedFormat(':name.:locale')
67
-                                 ->valueResolver(function ($model = null, $locale = null, $field) use ($fragment) {
67
+                                 ->valueResolver(function($model = null, $locale = null, $field) use ($fragment) {
68 68
                                      if (isset($field->value)) {
69 69
                                          return $field->value;
70 70
                                      }
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
         }
111 111
 
112 112
         // Take the fields from the first fragment as a starting point for duplication
113
-        return array_map(function (\Thinktomorrow\Chief\Fields\Types\Field $field) {
114
-            return $field->valueResolver(function ($model = null, $locale = null, $field) {
113
+        return array_map(function(\Thinktomorrow\Chief\Fields\Types\Field $field) {
114
+            return $field->valueResolver(function($model = null, $locale = null, $field) {
115 115
                 if ($field instanceof \Thinktomorrow\Chief\Fields\Types\MediaField) {
116 116
                     return [];
117 117
                 }
Please login to merge, or discard this patch.
src/OLD/Pages/PublishedFilter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
     public function apply($value = null): Closure
21 21
     {
22
-        return function ($query) use ($value) {
22
+        return function($query) use ($value) {
23 23
             if ($value == 'all') {
24 24
                 return $query;
25 25
             }
Please login to merge, or discard this patch.
src/OLD/Pages/PageManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $this->pageBuilderField(),
89 89
             InputField::make('title')->translatable($this->model->availableLocales())
90 90
                 ->validation('required-fallback-locale|max:200', [], [
91
-                    'trans.' . config('app.fallback_locale', 'nl') . '.title' => 'title',
91
+                    'trans.'.config('app.fallback_locale', 'nl').'.title' => 'title',
92 92
                 ])
93 93
                 ->label('Intern label')
94 94
                 ->description('Dit is de benaming die zal worden getoond in de admin selectie velden.')
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             if (is_array_empty($translation)) {
211 211
 
212 212
                 // Nullify all values
213
-                $trans[$locale] = array_map(function ($value) {
213
+                $trans[$locale] = array_map(function($value) {
214 214
                     return null;
215 215
                 }, $translation);
216 216
                 continue;
Please login to merge, or discard this patch.
src/Setup/Console/GeneratePage.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 
38 38
         // Set required paths
39 39
         $this->dirs = ['base' => $this->settings['base_path'] ?? base_path()];
40
-        $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'] . '/' . config('thinktomorrow.chief.domain.path', 'src');
41
-        $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'] . '/resources/views';
42
-        $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'] . '/app/Http/Controllers';
43
-        $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'] . '/routes/web.php';
40
+        $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'].'/'.config('thinktomorrow.chief.domain.path', 'src');
41
+        $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'].'/resources/views';
42
+        $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'].'/app/Http/Controllers';
43
+        $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'].'/routes/web.php';
44 44
     }
45 45
 
46 46
     public function handle()
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
     private function publishModel()
63 63
     {
64 64
         $this->publishFile(
65
-            __DIR__ . '/stubs/model.php.stub',
66
-            $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php',
65
+            __DIR__.'/stubs/model.php.stub',
66
+            $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php',
67 67
             'model'
68 68
         );
69 69
 
70
-        $this->addToConfig('collections', [$this->plural => $this->guessNamespace() . '\\' . ucfirst($this->singular)]);
70
+        $this->addToConfig('collections', [$this->plural => $this->guessNamespace().'\\'.ucfirst($this->singular)]);
71 71
     }
72 72
 
73 73
     private function publishController()
74 74
     {
75 75
         $this->publishFile(
76
-            __DIR__ . '/stubs/controller.php.stub',
77
-            $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php',
76
+            __DIR__.'/stubs/controller.php.stub',
77
+            $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php',
78 78
             'controller'
79 79
         );
80 80
     }
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
     private function modelTraits()
114 114
     {
115 115
         return [
116
-            '\\' . Publishable::class,
117
-            '\\' . Sortable::class,
116
+            '\\'.Publishable::class,
117
+            '\\'.Sortable::class,
118 118
             'q' => 'Proceed.',
119 119
         ];
120 120
     }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     protected function publishFile($from, $to, $type)
130 130
     {
131 131
         if ($this->filesystem->exists($to) && !$this->option('force')) {
132
-            if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) {
132
+            if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) {
133 133
                 return;
134 134
             }
135 135
         }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         $to = str_replace($this->dirs['base'], '', realpath($to));
170 170
 
171
-        $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>');
171
+        $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>');
172 172
     }
173 173
 
174 174
     protected function replacePlaceholders($content)
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
 
187 187
     private function generateImportStatements(): string
188 188
     {
189
-        return collect(['\\' . Page::class])
190
-            ->map(function ($statement) {
191
-                return 'use ' . $statement . ";\n    ";
189
+        return collect(['\\'.Page::class])
190
+            ->map(function($statement) {
191
+                return 'use '.$statement.";\n    ";
192 192
             })->implode('');
193 193
     }
194 194
 
195 195
     private function generateTraitStatements(): string
196 196
     {
197 197
         return collect($this->chosenTraits)
198
-            ->map(function ($statement) {
199
-                return 'use ' . $statement . ";\n    ";
198
+            ->map(function($statement) {
199
+                return 'use '.$statement.";\n    ";
200 200
             })->implode('');
201 201
     }
202 202
 
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 
216 216
         // We make an estimated guess based on the project name. At Think Tomorrow, we
217 217
         // have a src folder which is PSR-4 namespaced by the project name itself.
218
-        return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')) . '\\' . ucfirst($this->plural));
218
+        return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'.ucfirst($this->plural));
219 219
     }
220 220
 
221 221
     private function addToConfig($configKey, $value)
222 222
     {
223
-        $current_values = config('thinktomorrow.chief.' . $configKey);
223
+        $current_values = config('thinktomorrow.chief.'.$configKey);
224 224
 
225 225
         if (is_array($current_values)) {
226 226
             $value = array_merge($current_values, $value);
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
         // Find value - note: this regex does not work for nested arrays!
237 237
         // Also creates array with the non-short syntax.
238
-        $content = preg_replace('/[\'|"]' . $key . '[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content);
238
+        $content = preg_replace('/[\'|"]'.$key.'[\'|"] ?=> ?(\[[^\]]*\]|[\'|"].*[\'|"])/', var_export($value, true), $content);
239 239
 
240 240
         file_put_contents($file, $content);
241 241
     }
Please login to merge, or discard this patch.