Completed
Push — ft/states ( d9d02a...d4f7ca )
by Ben
45:58 queued 35:27
created
src/PageBuilder/UpdateSections.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     private function removeExistingSets()
91 91
     {
92 92
         foreach ($this->model->children() as $instance) {
93
-            if (! $instance instanceof StoredSetReference) {
93
+            if (!$instance instanceof StoredSetReference) {
94 94
                 continue;
95 95
             }
96 96
             $this->model->rejectChild($instance);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         }
145 145
 
146 146
         foreach ($this->text_modules['replace'] as $text_module) {
147
-            if (! $module = FlatReferenceFactory::fromString($text_module['id'])->instance()) {
147
+            if (!$module = FlatReferenceFactory::fromString($text_module['id'])->instance()) {
148 148
                 continue;
149 149
             }
150 150
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
     private function removeTextualModule($module)
165 165
     {
166
-        if (! $module instanceof TextModule && ! $module instanceof PagetitleModule) {
166
+        if (!$module instanceof TextModule && !$module instanceof PagetitleModule) {
167 167
             throw new \Exception('Invalid request to remove non textual module');
168 168
         }
169 169
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                 continue;
186 186
             }
187 187
 
188
-            $child = $children->first(function ($c) use ($reference) {
188
+            $child = $children->first(function($c) use ($reference) {
189 189
                 return $c->flatReference()->get() == $reference;
190 190
             });
191 191
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     private function stripTagsBlacklist($value, $blacklist = [])
237 237
     {
238 238
         foreach ($blacklist as $tag) {
239
-            $value = preg_replace('/<\/?' . $tag . '(.|\s)*?>/', '', $value);
239
+            $value = preg_replace('/<\/?'.$tag.'(.|\s)*?>/', '', $value);
240 240
         }
241 241
 
242 242
         return $value;
Please login to merge, or discard this patch.
src/Modules/Module.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             return static::$managedModelKey;
68 68
         }
69 69
 
70
-        throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class. '.');
70
+        throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.');
71 71
     }
72 72
 
73 73
     /**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public static function availableForCreation(): Collection
78 78
     {
79
-        $managers = app(Managers::class)->findByTag('module')->filter(function ($manager) {
79
+        $managers = app(Managers::class)->findByTag('module')->filter(function($manager) {
80 80
             return $manager->can('create');
81
-        })->map(function ($manager) {
81
+        })->map(function($manager) {
82 82
             return $manager->details();
83 83
         });
84 84
 
Please login to merge, or discard this patch.
src/Management/Nomadic.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function nomadicCan($verb)
10 10
     {
11
-        if (in_array($verb, ['create', 'store', 'delete']) && ! auth()->guard('chief')->user()->hasRole('developer')) {
11
+        if (in_array($verb, ['create', 'store', 'delete']) && !auth()->guard('chief')->user()->hasRole('developer')) {
12 12
             throw NotAllowedManagerRoute::notAllowedVerb($verb, $this);
13 13
         }
14 14
 
Please login to merge, or discard this patch.
src/Management/Managers.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $registrations = collect($this->register->filterByTag($tag)->all());
52 52
 
53
-        return $registrations->map(function ($registration) {
53
+        return $registrations->map(function($registration) {
54 54
             return $this->instance($registration);
55 55
         });
56 56
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $registrations = collect($this->register->filterByTag($tag)->all());
67 67
 
68
-        return $registrations->map(function ($registration) {
68
+        return $registrations->map(function($registration) {
69 69
             return $this->instance($registration)->details();
70 70
         });
71 71
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         //return array with group name and values
77 77
         $grouped = [];
78 78
 
79
-        $managers = $managers->map(function (Manager $item) {
79
+        $managers = $managers->map(function(Manager $item) {
80 80
             return [
81 81
                 'id'    => $item->details()->id,
82 82
                 'group' => $item->details()->plural,
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $registrations = collect($this->register->all());
92 92
 
93
-        return $registrations->map(function ($registration) {
93
+        return $registrations->map(function($registration) {
94 94
             return $this->instance($registration);
95 95
         });
96 96
     }
97 97
 
98 98
     public function anyRegisteredByTag($tag)
99 99
     {
100
-        return ! empty($this->register->filterByTag($tag)->all());
100
+        return !empty($this->register->filterByTag($tag)->all());
101 101
     }
102 102
 
103 103
     /**
Please login to merge, or discard this patch.
src/Pages/Page.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             return static::$managedModelKey;
85 85
         }
86 86
 
87
-        throw new \Exception('Missing required static property \'managedModelKey\' on ' . static::class. '.');
87
+        throw new \Exception('Missing required static property \'managedModelKey\' on '.static::class.'.');
88 88
     }
89 89
 
90 90
     /**
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
     public function flatReferenceLabel(): string
125 125
     {
126 126
         if ($this->exists) {
127
-            $status = ! $this->isPublished() ? ' [' . $this->statusAsPlainLabel().']' : null;
127
+            $status = !$this->isPublished() ? ' ['.$this->statusAsPlainLabel().']' : null;
128 128
 
129
-            return $this->title ? $this->title . $status : '';
129
+            return $this->title ? $this->title.$status : '';
130 130
         }
131 131
 
132 132
         return '';
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $classKey = get_class($this);
138 138
         if (property_exists($this, 'labelSingular')) {
139
-            $labelSingular =  $this->labelSingular;
140
-        } else {
139
+            $labelSingular = $this->labelSingular;
140
+        }else {
141 141
             $labelSingular = Str::singular($classKey);
142 142
         }
143 143
 
Please login to merge, or discard this patch.
src/Fields/Types/Field.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 namespace Thinktomorrow\Chief\Fields\Types;
6 6
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     public function optional(): bool
73 73
     {
74
-        return ! $this->required();
74
+        return !$this->required();
75 75
     }
76 76
 
77 77
     public function name(string $name = null)
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     private function defaultValueResolver(): callable
148 148
     {
149
-        return function (Model $model, $locale) {
149
+        return function(Model $model, $locale) {
150 150
             if ($this->isTranslatable() && $locale) {
151 151
                 return $model->getTranslationFor($this->column(), $locale);
152 152
             }
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         }
215 215
 
216 216
         if (!in_array($name, ['label', 'key', 'description', 'column', 'name', 'prepend', 'append'])) {
217
-            throw new \InvalidArgumentException('Cannot set value by ['. $name .'].');
217
+            throw new \InvalidArgumentException('Cannot set value by ['.$name.'].');
218 218
         }
219 219
 
220 220
         $this->values[$name] = $arguments[0];
Please login to merge, or discard this patch.
src/Management/AbstractManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             return $this->indexPagination($builder);
85 85
         }
86 86
         
87
-        return $builder->get()->map(function ($model) {
87
+        return $builder->get()->map(function($model) {
88 88
             return (new static($this->registration))->manage($model);
89 89
         });
90 90
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $paginator = $builder->paginate($this->pageCount);
114 114
 
115
-        $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function ($model) {
115
+        $modifiedCollection = $builder->paginate($this->pageCount)->getCollection()->transform(function($model) {
116 116
             return (new static($this->registration))->manage($model);
117 117
         });
118 118
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
     public function guard($verb): Manager
188 188
     {
189
-        if (! $this->can($verb)) {
189
+        if (!$this->can($verb)) {
190 190
             NotAllowedManagerRoute::notAllowedVerb($verb, $this);
191 191
         }
192 192
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         $fields = $this->fields();
210 210
 
211 211
         foreach ($this->assistants() as $assistant) {
212
-            if (! method_exists($assistant, 'fields')) {
212
+            if (!method_exists($assistant, 'fields')) {
213 213
                 continue;
214 214
             }
215 215
 
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
             static::$bootedTraitMethods[$baseMethod] = [];
292 292
         
293 293
             foreach (class_uses_recursive($class) as $trait) {
294
-                $method = class_basename($trait) . ucfirst($baseMethod);
294
+                $method = class_basename($trait).ucfirst($baseMethod);
295 295
                 
296
-                if (method_exists($class, $method) && ! in_array($method, static::$bootedTraitMethods[$baseMethod])) {
296
+                if (method_exists($class, $method) && !in_array($method, static::$bootedTraitMethods[$baseMethod])) {
297 297
                     static::$bootedTraitMethods[$baseMethod][] = lcfirst($method);
298 298
                 }
299 299
             }
Please login to merge, or discard this patch.
src/Media/UploadMedia.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         if (isset(json_decode($file)->output)) {
114 114
             $image_name = json_decode($file)->output->name;
115 115
             $asset      = app(AddAsset::class)->add($model, json_decode($file)->output->image, $type, $locale, $this->sluggifyFilename($image_name));
116
-        } else {
116
+        }else {
117 117
             if ($file instanceof UploadedFile) {
118 118
                 $image_name = $file->getClientOriginalName();
119 119
                 $asset      = app(AddAsset::class)->add($model, $file, $type, $locale, $this->sluggifyFilename($image_name));
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
                 // New files are passed with their filename (instead of their id)
122 122
                 // For new files we will replace the filename with the id.
123 123
                 if (false !== ($key = array_search($image_name, $files_order))) {
124
-                    $files_order[$key] = (string) $asset->id;
124
+                    $files_order[$key] = (string)$asset->id;
125 125
                 }
126
-            } else {
126
+            }else {
127 127
                 $file       = Asset::findOrFail($file);
128 128
                 $asset      = app(AddAsset::class)->add($model, $file, $type, $locale);
129 129
             }
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
      */
137 137
     private function sluggifyFilename($filename): string
138 138
     {
139
-        $extension = substr($filename, strrpos($filename, '.') + 1);
139
+        $extension = substr($filename, strrpos($filename, '.')+1);
140 140
         $filename  = substr($filename, 0, strrpos($filename, '.'));
141
-        $filename  = Str::slug($filename) . '.' . $extension;
141
+        $filename  = Str::slug($filename).'.'.$extension;
142 142
 
143 143
         return $filename;
144 144
     }
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
                 if ($file instanceof UploadedFile && !$file->isValid()) {
155 155
                     if ($file->getError() == UPLOAD_ERR_INI_SIZE) {
156 156
                         throw new FileTooBigException(
157
-                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' .
158
-                            'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' .
159
-                            'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB'
157
+                            'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '.
158
+                            'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '.
159
+                            'post_max_size: '.(int)(ini_get('post_max_size')).'MB'
160 160
                         );
161 161
                     }
162 162
                 }
@@ -170,16 +170,16 @@  discard block
 block discarded – undo
170 170
         foreach ($files_by_type as $type => $files) {
171 171
             foreach ($files as $locale => $_files) {
172 172
                 if (!in_array($locale, config('translatable.locales'))) {
173
-                    throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale [' . implode(',', config('translatable.locales', [])). ']. Instead [' . $locale . '] is given.');
173
+                    throw new \InvalidArgumentException('Corrupt file payload. key is expected to be a valid locale ['.implode(',', config('translatable.locales', [])).']. Instead ['.$locale.'] is given.');
174 174
                 }
175 175
 
176 176
                 if (!is_array($_files)) {
177
-                    throw new \InvalidArgumentException('A valid files entry should be an array of files, key with either [new, replace or delete]. Instead a ' . gettype($_files) . ' is given.');
177
+                    throw new \InvalidArgumentException('A valid files entry should be an array of files, key with either [new, replace or delete]. Instead a '.gettype($_files).' is given.');
178 178
                 }
179 179
 
180 180
                 foreach ($_files as $action => $file) {
181 181
                     if (!in_array($action, $actions)) {
182
-                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead ' . $action . ' is given.');
182
+                        throw new \InvalidArgumentException('A valid files entry should have a key of either ['.implode(',', $actions).']. Instead '.$action.' is given.');
183 183
                     }
184 184
                 }
185 185
             }
Please login to merge, or discard this patch.
src/Relations/Relation.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             ->orderBy('sort', 'ASC')
47 47
             ->get();
48 48
 
49
-        return $relations->map(function (Relation $relation) {
49
+        return $relations->map(function(Relation $relation) {
50 50
             $parent = $relation->parent;
51 51
             $parent->relation = $relation;
52 52
             return $parent;
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
                             ->orderBy('sort', 'ASC')
61 61
                             ->get();
62 62
 
63
-        return $relations->map(function (Relation $relation) use ($parent_type, $parent_id) {
63
+        return $relations->map(function(Relation $relation) use ($parent_type, $parent_id) {
64 64
 
65 65
             // It could be that the child itself is soft-deleted, if this is the case, we will ignore it and move on.
66 66
             if (!$child = $relation->child) {
67 67
                 if (!$relation->child()->withTrashed()->first()) {
68 68
 //                if ((!method_exists($childInstance, 'trashed')) || ! $childInstance->onlyTrashed()->find($relation->child_id)) {
69 69
                     // If we cannot retrieve it then he collection type is possibly off, this is a database inconsistency and should be addressed
70
-                    throw new \DomainException('Corrupt relation reference. Related child ['.$relation->child_type.'@'.$relation->child_id.'] could not be retrieved for parent [' . $parent_type.'@'.$parent_id.']. Make sure the morph key can resolve to a valid class.');
70
+                    throw new \DomainException('Corrupt relation reference. Related child ['.$relation->child_type.'@'.$relation->child_id.'] could not be retrieved for parent ['.$parent_type.'@'.$parent_id.']. Make sure the morph key can resolve to a valid class.');
71 71
                 }
72 72
 
73 73
                 return null;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         })
80 80
 
81 81
         // In case of soft-deleted entries, this will be null and should be ignored. We make sure that keys are reset in case of removed child
82
-        ->reject(function ($child) {
82
+        ->reject(function($child) {
83 83
             return is_null($child);
84 84
         })
85 85
         ->values();
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 
97 97
     public static function deleteRelationsOf($type, $id)
98 98
     {
99
-        $relations = static::where(function ($query) use ($type, $id) {
99
+        $relations = static::where(function($query) use ($type, $id) {
100 100
             return $query->where('parent_type', $type)
101 101
                          ->where('parent_id', $id);
102
-        })->orWhere(function ($query) use ($type, $id) {
102
+        })->orWhere(function($query) use ($type, $id) {
103 103
             return $query->where('child_type', $type)
104 104
                 ->where('child_id', $id);
105 105
         })->get();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
     public static function deleteAllChildRelationsOf($type, $id)
113 113
     {
114
-        $relations = static::where(function ($query) use ($type, $id) {
114
+        $relations = static::where(function($query) use ($type, $id) {
115 115
             return $query->where('parent_type', $type)
116 116
                 ->where('parent_id', $id);
117 117
         })->get();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
     public static function deleteAllParentRelationsOf($type, $id)
125 125
     {
126
-        $relations = static::where(function ($query) use ($type, $id) {
126
+        $relations = static::where(function($query) use ($type, $id) {
127 127
             return $query->where('child_type', $type)
128 128
                 ->where('child_id', $id);
129 129
         })->get();
Please login to merge, or discard this patch.