Test Setup Failed
Push — a-simpler-manager ( 0b86bc...b39f07 )
by Ben
06:34
created
src/Sandbox/CatalogPages/Sushi.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
         $modelPath = (new \ReflectionClass(static::class))->getFileName();
35 35
 
36 36
         $states = [
37
-            'cache-file-found-and-up-to-date' => function () use ($cachePath) {
37
+            'cache-file-found-and-up-to-date' => function() use ($cachePath) {
38 38
                 static::setSqliteConnection($cachePath);
39 39
             },
40
-            'cache-file-not-found-or-stale' => function () use ($cachePath, $modelPath, $instance) {
40
+            'cache-file-not-found-or-stale' => function() use ($cachePath, $modelPath, $instance) {
41 41
                 file_put_contents($cachePath, '');
42 42
 
43 43
                 static::setSqliteConnection($cachePath);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
                 touch($cachePath, filemtime($modelPath));
48 48
             },
49
-            'no-caching-capabilities' => function () use ($instance) {
49
+            'no-caching-capabilities' => function() use ($instance) {
50 50
                 static::setSqliteConnection(':memory:');
51 51
 
52 52
                 $instance->migrate();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         ];
55 55
 
56 56
         switch (true) {
57
-            case ! property_exists($instance, 'rows'):
57
+            case !property_exists($instance, 'rows'):
58 58
                 $states['no-caching-capabilities']();
59 59
                 break;
60 60
 
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
         $firstRow = $rows[0];
87 87
         $tableName = $this->getTable();
88 88
 
89
-        static::resolveConnection()->getSchemaBuilder()->create($tableName, function ($table) use ($firstRow) {
89
+        static::resolveConnection()->getSchemaBuilder()->create($tableName, function($table) use ($firstRow) {
90 90
             // Add the "id" column if it doesn't already exist in the rows.
91
-            if ($this->incrementing && ! in_array($this->primaryKey, array_keys($firstRow))) {
91
+            if ($this->incrementing && !in_array($this->primaryKey, array_keys($firstRow))) {
92 92
                 $table->increments($this->primaryKey);
93 93
             }
94 94
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 $table->{$type}($column)->nullable();
123 123
             }
124 124
 
125
-            if ($this->usesTimestamps() && (! in_array('updated_at', array_keys($firstRow)) || ! in_array('created_at', array_keys($firstRow)))) {
125
+            if ($this->usesTimestamps() && (!in_array('updated_at', array_keys($firstRow)) || !in_array('created_at', array_keys($firstRow)))) {
126 126
                 $table->timestamps();
127 127
             }
128 128
         });
Please login to merge, or discard this patch.
src/Sandbox/CatalogPages/CatalogPageManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $parameters = array_merge((array)$modelId, $parameters);
64 64
         }
65 65
 
66
-        return route('chief.' . self::managerKey() . '.' . $action, $parameters);
66
+        return route('chief.'.self::managerKey().'.'.$action, $parameters);
67 67
     }
68 68
 
69 69
     public function can(string $action): bool
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $model->saveFields($model->fields(), $request);
151 151
 
152 152
         return redirect()->to($this->route('edit', $model))
153
-            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "' . $model->adminLabel('title') . '" is toegevoegd');
153
+            ->with('messages.success', '<i class="fa fa-fw fa-check-circle"></i>  "'.$model->adminLabel('title').'" is toegevoegd');
154 154
     }
155 155
 
156 156
     public function edit($id)
Please login to merge, or discard this patch.
src/Sandbox/CatalogPages/SimpleServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function boot()
14 14
     {
15 15
         // Make one global managedRoutes collection
16
-        foreach([
16
+        foreach ([
17 17
 //            CatalogPageManager::class => ['model' => CatalogPageModel::class],
18 18
             BlogpostManager::class,
19 19
             FakieManager::class,
Please login to merge, or discard this patch.
src/Sandbox/CatalogPages/CatalogPageModel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@
 block discarded – undo
44 44
     {
45 45
         return [
46 46
             'title' => $this->title,
47
-            'subtitle' => 'awesome subtitle id: ' . $this->id,
47
+            'subtitle' => 'awesome subtitle id: '.$this->id,
48 48
         ];
49 49
     }
50 50
 
51 51
     public function adminLabel(string $key, array $replace = [], $default = null): ?string
52 52
     {
53
-        if(!array_key_exists($key, $this->adminLabels())) {
53
+        if (!array_key_exists($key, $this->adminLabels())) {
54 54
             return $default;
55 55
         }
56 56
 
Please login to merge, or discard this patch.
src/Sandbox/Blog/Blogpost.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public function fields(): Fields
34 34
     {
35 35
         return new Fields([
36
-            TextField::make('content')->locales(['nl','en']),
36
+            TextField::make('content')->locales(['nl', 'en']),
37 37
             InputField::make('title'),
38 38
         ]);
39 39
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function adminLabel(string $key, array $replace = [], $default = null): ?string
62 62
     {
63
-        if(!array_key_exists($key, $this->adminLabels())) {
63
+        if (!array_key_exists($key, $this->adminLabels())) {
64 64
             return $default;
65 65
         }
66 66
 
Please login to merge, or discard this patch.
src/Sandbox/Blog/BlogpostManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function route(string $action, $model = null, ...$parameters): string
59 59
     {
60
-        foreach(DiscoverTraitMethods::belongingTo(static::class, 'route') as $method) {
61
-            if(null !== ($route = $this->$method($action, $model, ...$parameters))){
60
+        foreach (DiscoverTraitMethods::belongingTo(static::class, 'route') as $method) {
61
+            if (null !== ($route = $this->$method($action, $model, ...$parameters))) {
62 62
                 return $route;
63 63
             }
64 64
         }
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 
69 69
     public function can($action, $model = null): bool
70 70
     {
71
-        foreach(DiscoverTraitMethods::belongingTo(static::class, 'can') as $method) {
72
-            if(true === $this->$method($action, $model)){
71
+        foreach (DiscoverTraitMethods::belongingTo(static::class, 'can') as $method) {
72
+            if (true === $this->$method($action, $model)) {
73 73
                 return true;
74 74
             }
75 75
         }
Please login to merge, or discard this patch.
src/Concerns/Morphable/Morphable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 
59 59
     protected function initializeMorphable()
60 60
     {
61
-        if(!isset($this->morph_key)) {
61
+        if (!isset($this->morph_key)) {
62 62
             $this->morph_key = $this->morphKey();
63 63
         }
64 64
     }
Please login to merge, or discard this patch.
src/ManagedModels/Application/DeleteManagedModel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             // Mark the slug as deleted to avoid any conflict with newly created modules with the same slug.
36 36
             if ($model instanceof Module) {
37 37
                 $model->update([
38
-                    'slug' => $model->slug . $this->deletionAppendix(),
38
+                    'slug' => $model->slug.$this->deletionAppendix(),
39 39
                 ]);
40 40
             }
41 41
 
@@ -70,6 +70,6 @@  discard block
 block discarded – undo
70 70
 
71 71
     private function deletionAppendix(): string
72 72
     {
73
-        return '_DELETED_' . time();
73
+        return '_DELETED_'.time();
74 74
     }
75 75
 }
Please login to merge, or discard this patch.
src/ManagedModels/Assistants/SavingFields.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function saveFields(Fields $fields, array $input, array $files): void
29 29
     {
30
-        foreach($fields as $field){
31
-            if($this->detectCustomSaveMethod($field)) {
30
+        foreach ($fields as $field) {
31
+            if ($this->detectCustomSaveMethod($field)) {
32 32
                 continue;
33 33
             }
34 34
 
35
-            if(!$field->isLocalized())
35
+            if (!$field->isLocalized())
36 36
             {
37 37
                 // Set standard non-localized attribute on the model
38 38
                 ($customSetMethod = $this->detectCustomSetMethod($field))
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
             // Dynamic localized values or standard translated
46 46
             // For standard translations we set value with the colon notation, e.g. title:en
47 47
             $this->foreachTranslationEntry(data_get($input, 'trans', []), function($locale, $key, $value) use($field){
48
-                if($key !== $field->getColumn()) return;
48
+                if ($key !== $field->getColumn()) return;
49 49
 
50
-                if($this->isFieldForDynamicValue($field)) {
50
+                if ($this->isFieldForDynamicValue($field)) {
51 51
                     $this->setDynamic($key, $value, $locale);
52
-                } else {
52
+                }else {
53 53
                     $this->{$field->getColumn().':'.$locale} = $value;
54 54
                 }
55 55
             });
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
         $this->save();
59 59
 
60 60
         // Custom save methods
61
-        foreach($fields as $field){
62
-            if($customSaveMethod = $this->detectCustomSaveMethod($field)) {
61
+        foreach ($fields as $field) {
62
+            if ($customSaveMethod = $this->detectCustomSaveMethod($field)) {
63 63
                 $this->$customSaveMethod($field, $input, $files);
64 64
             }
65 65
         }
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 
73 73
     private function detectCustomSaveMethod(Field $field): ?string
74 74
     {
75
-        $saveMethodByKey = 'save' . ucfirst(Str::camel($field->getKey())) . 'Field';
76
-        $saveMethodByType = 'save' . ucfirst(Str::camel($field->getType()->get())) . 'Fields';
75
+        $saveMethodByKey = 'save'.ucfirst(Str::camel($field->getKey())).'Field';
76
+        $saveMethodByType = 'save'.ucfirst(Str::camel($field->getType()->get())).'Fields';
77 77
 
78 78
         foreach ([$saveMethodByKey, $saveMethodByType] as $saveMethod) {
79 79
             if (method_exists($this, $saveMethod)) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     private function detectCustomSetMethod(Field $field): ?string
88 88
     {
89
-        $methodName = 'set' . ucfirst(Str::camel($field->getKey())) . 'Field';
89
+        $methodName = 'set'.ucfirst(Str::camel($field->getKey())).'Field';
90 90
 
91 91
         return (method_exists($this, $methodName)) ? $methodName : null;
92 92
     }
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 
109 109
     private function saveImageFields(ImageField $field, array $input)
110 110
     {
111
-        app(ImageFieldHandler::class)->handle($this, $field, data_get($input, 'images.' . $field->getName(), []), $input);
111
+        app(ImageFieldHandler::class)->handle($this, $field, data_get($input, 'images.'.$field->getName(), []), $input);
112 112
     }
113 113
 
114 114
     private function foreachTranslationEntry(array $translations, \Closure $callback)
115 115
     {
116
-        foreach($translations as $locale => $trans){
117
-            foreach($trans as $key => $value){
116
+        foreach ($translations as $locale => $trans) {
117
+            foreach ($trans as $key => $value) {
118 118
                 call_user_func($callback, $locale, $key, $value);
119 119
             }
120 120
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@
 block discarded – undo
45 45
             // Dynamic localized values or standard translated
46 46
             // For standard translations we set value with the colon notation, e.g. title:en
47 47
             $this->foreachTranslationEntry(data_get($input, 'trans', []), function($locale, $key, $value) use($field){
48
-                if($key !== $field->getColumn()) return;
48
+                if($key !== $field->getColumn()) {
49
+                    return;
50
+                }
49 51
 
50 52
                 if($this->isFieldForDynamicValue($field)) {
51 53
                     $this->setDynamic($key, $value, $locale);
Please login to merge, or discard this patch.