We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function afterField($targetFieldName) |
| 140 | 140 | { |
| 141 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
| 141 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
| 142 | 142 | return $this->moveField($fields, $targetFieldName, false); |
| 143 | 143 | }); |
| 144 | 144 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function beforeField($targetFieldName) |
| 152 | 152 | { |
| 153 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
| 153 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
| 154 | 154 | return $this->moveField($fields, $targetFieldName, true); |
| 155 | 155 | }); |
| 156 | 156 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | public function makeFirstField() |
| 164 | 164 | { |
| 165 | - if (! $this->fields()) { |
|
| 165 | + if (!$this->fields()) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function removeField($name) |
| 179 | 179 | { |
| 180 | - $this->transformFields(function ($fields) use ($name) { |
|
| 180 | + $this->transformFields(function($fields) use ($name) { |
|
| 181 | 181 | Arr::forget($fields, $name); |
| 182 | 182 | |
| 183 | 183 | return $fields; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function removeFields($array_of_names) |
| 193 | 193 | { |
| 194 | - if (! empty($array_of_names)) { |
|
| 194 | + if (!empty($array_of_names)) { |
|
| 195 | 195 | foreach ($array_of_names as $name) { |
| 196 | 196 | $this->removeField($name); |
| 197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | public function removeAllFields() |
| 205 | 205 | { |
| 206 | 206 | $current_fields = $this->getCleanStateFields(); |
| 207 | - if (! empty($current_fields)) { |
|
| 207 | + if (!empty($current_fields)) { |
|
| 208 | 208 | foreach ($current_fields as $field) { |
| 209 | 209 | $this->removeField($field['name']); |
| 210 | 210 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $jsonCastables = ['array', 'object', 'json']; |
| 300 | 300 | $fieldCasting = $casted_attributes[$field['name']]; |
| 301 | 301 | |
| 302 | - if (in_array($fieldCasting, $jsonCastables) && isset($input[$field['name']]) && ! empty($input[$field['name']]) && ! is_array($input[$field['name']])) { |
|
| 302 | + if (in_array($fieldCasting, $jsonCastables) && isset($input[$field['name']]) && !empty($input[$field['name']]) && !is_array($input[$field['name']])) { |
|
| 303 | 303 | try { |
| 304 | 304 | $input[$field['name']] = json_decode($input[$field['name']]); |
| 305 | 305 | } catch (\Exception $e) { |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | public function orderFields($order) |
| 330 | 330 | { |
| 331 | - $this->transformFields(function ($fields) use ($order) { |
|
| 331 | + $this->transformFields(function($fields) use ($order) { |
|
| 332 | 332 | return $this->applyOrderToFields($fields, $order); |
| 333 | 333 | }); |
| 334 | 334 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | public function hasUploadFields() |
| 355 | 355 | { |
| 356 | 356 | $fields = $this->getCleanStateFields(); |
| 357 | - $upload_fields = Arr::where($fields, function ($value, $key) { |
|
| 357 | + $upload_fields = Arr::where($fields, function($value, $key) { |
|
| 358 | 358 | // check if any subfields have uploads |
| 359 | 359 | if (isset($value['subfields'])) { |
| 360 | 360 | foreach ($value['subfields'] as $subfield) { |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $alreadyLoaded = $this->getLoadedFieldTypes(); |
| 427 | 427 | $type = $this->getFieldTypeWithNamespace($field); |
| 428 | 428 | |
| 429 | - if (! in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
| 429 | + if (!in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
| 430 | 430 | $alreadyLoaded[] = $type; |
| 431 | 431 | $this->setLoadedFieldTypes($alreadyLoaded); |
| 432 | 432 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | */ |
| 468 | 468 | public function fieldTypeNotLoaded($field) |
| 469 | 469 | { |
| 470 | - return ! in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
| 470 | + return !in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | /** |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | */ |
| 517 | 517 | public function hasFieldWhere($attribute, $value) |
| 518 | 518 | { |
| 519 | - $match = Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) { |
|
| 519 | + $match = Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) { |
|
| 520 | 520 | return isset($field[$attribute]) && $field[$attribute] == $value; |
| 521 | 521 | }); |
| 522 | 522 | |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | */ |
| 533 | 533 | public function firstFieldWhere($attribute, $value) |
| 534 | 534 | { |
| 535 | - return Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) { |
|
| 535 | + return Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) { |
|
| 536 | 536 | return isset($field[$attribute]) && $field[$attribute] == $value; |
| 537 | 537 | }); |
| 538 | 538 | } |
@@ -66,24 +66,24 @@ discard block |
||
| 66 | 66 | include_once __DIR__.'/macros.php'; |
| 67 | 67 | |
| 68 | 68 | // Bind the CrudPanel object to Laravel's service container |
| 69 | - $this->app->scoped('crud', function ($app) { |
|
| 69 | + $this->app->scoped('crud', function($app) { |
|
| 70 | 70 | return new CrudPanel(); |
| 71 | 71 | }); |
| 72 | 72 | |
| 73 | - $this->app->scoped('DatabaseSchema', function ($app) { |
|
| 73 | + $this->app->scoped('DatabaseSchema', function($app) { |
|
| 74 | 74 | return new DatabaseSchema(); |
| 75 | 75 | }); |
| 76 | 76 | |
| 77 | - $this->app->singleton('BackpackViewNamespaces', function ($app) { |
|
| 77 | + $this->app->singleton('BackpackViewNamespaces', function($app) { |
|
| 78 | 78 | return new ViewNamespaces(); |
| 79 | 79 | }); |
| 80 | 80 | |
| 81 | 81 | // Bind the widgets collection object to Laravel's service container |
| 82 | - $this->app->singleton('widgets', function ($app) { |
|
| 82 | + $this->app->singleton('widgets', function($app) { |
|
| 83 | 83 | return new Collection(); |
| 84 | 84 | }); |
| 85 | 85 | |
| 86 | - $this->app->scoped('UploadersRepository', function ($app) { |
|
| 86 | + $this->app->scoped('UploadersRepository', function($app) { |
|
| 87 | 87 | return new UploadersRepository(); |
| 88 | 88 | }); |
| 89 | 89 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $middleware_key = config('backpack.base.middleware_key'); |
| 100 | 100 | $middleware_class = config('backpack.base.middleware_class'); |
| 101 | 101 | |
| 102 | - if (! is_array($middleware_class)) { |
|
| 102 | + if (!is_array($middleware_class)) { |
|
| 103 | 103 | $router->pushMiddlewareToGroup($middleware_key, $middleware_class); |
| 104 | 104 | |
| 105 | 105 | return; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $operationConfigs = scandir(__DIR__.'/config/backpack/operations/'); |
| 216 | 216 | $operationConfigs = array_diff($operationConfigs, ['.', '..']); |
| 217 | 217 | |
| 218 | - if (! count($operationConfigs)) { |
|
| 218 | + if (!count($operationConfigs)) { |
|
| 219 | 219 | return; |
| 220 | 220 | } |
| 221 | 221 | |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | * - when true: `address[street]` |
| 20 | 20 | * - when false: `[address][street]` |
| 21 | 21 | */ |
| 22 | -if (! Str::hasMacro('dotsToSquareBrackets')) { |
|
| 23 | - Str::macro('dotsToSquareBrackets', function ($string, $ignore = [], $keyFirst = true) { |
|
| 22 | +if (!Str::hasMacro('dotsToSquareBrackets')) { |
|
| 23 | + Str::macro('dotsToSquareBrackets', function($string, $ignore = [], $keyFirst = true) { |
|
| 24 | 24 | $stringParts = explode('.', $string); |
| 25 | 25 | $result = ''; |
| 26 | 26 | |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | return $result; |
| 35 | 35 | }); |
| 36 | 36 | } |
| 37 | -if (! CrudColumn::hasMacro('withFiles')) { |
|
| 38 | - CrudColumn::macro('withFiles', function ($uploadDefinition = [], $subfield = null) { |
|
| 37 | +if (!CrudColumn::hasMacro('withFiles')) { |
|
| 38 | + CrudColumn::macro('withFiles', function($uploadDefinition = [], $subfield = null) { |
|
| 39 | 39 | /** @var CrudField|CrudColumn $this */ |
| 40 | 40 | RegisterUploadEvents::handle($this, $uploadDefinition, 'withFiles', $subfield); |
| 41 | 41 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | }); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -if (! CrudField::hasMacro('withFiles')) { |
|
| 47 | - CrudField::macro('withFiles', function ($uploadDefinition = [], $subfield = null) { |
|
| 46 | +if (!CrudField::hasMacro('withFiles')) { |
|
| 47 | + CrudField::macro('withFiles', function($uploadDefinition = [], $subfield = null) { |
|
| 48 | 48 | /** @var CrudField|CrudColumn $this */ |
| 49 | 49 | RegisterUploadEvents::handle($this, $uploadDefinition, 'withFiles', $subfield); |
| 50 | 50 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * It will go to the given CrudController and get the setupRoutes() method on it. |
| 60 | 60 | */ |
| 61 | -if (! Route::hasMacro('crud')) { |
|
| 62 | - Route::macro('crud', function ($name, $controller) { |
|
| 61 | +if (!Route::hasMacro('crud')) { |
|
| 62 | + Route::macro('crud', function($name, $controller) { |
|
| 63 | 63 | // put together the route name prefix, |
| 64 | 64 | // as passed to the Route::group() statements |
| 65 | 65 | $routeName = ''; |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | if (isset($attributes['subfields'])) { |
| 47 | 47 | foreach ($attributes['subfields'] as $subfield) { |
| 48 | 48 | if (isset($subfield[$macro])) { |
| 49 | - $config = ! is_array($subfield[$macro]) ? [] : $subfield[$macro]; |
|
| 49 | + $config = !is_array($subfield[$macro]) ? [] : $subfield[$macro]; |
|
| 50 | 50 | $this->{$macro}($config, $subfield); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | private string $crudObjectType; |
| 15 | 15 | |
| 16 | 16 | public function __construct( |
| 17 | - private readonly CrudField|CrudColumn $crudObject, |
|
| 17 | + private readonly CrudField | CrudColumn $crudObject, |
|
| 18 | 18 | private readonly array $uploaderConfiguration, |
| 19 | 19 | private readonly string $macro |
| 20 | 20 | ) { |
| 21 | 21 | $this->crudObjectType = is_a($crudObject, CrudField::class) ? 'field' : (is_a($crudObject, CrudColumn::class) ? 'column' : null); |
| 22 | 22 | |
| 23 | - if (! $this->crudObjectType) { |
|
| 23 | + if (!$this->crudObjectType) { |
|
| 24 | 24 | abort(500, 'Upload handlers only work for CrudField and CrudColumn classes.'); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | if ($this->crudObjectType === 'field') { |
| 60 | - $model::saving(function ($entry) use ($uploader) { |
|
| 60 | + $model::saving(function($entry) use ($uploader) { |
|
| 61 | 61 | $updatedCountKey = 'uploaded_'.($uploader->getRepeatableContainerName() ?? $uploader->getName()).'_count'; |
| 62 | 62 | |
| 63 | 63 | CRUD::set($updatedCountKey, CRUD::get($updatedCountKey) ?? 0); |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | }); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $model::retrieved(function ($entry) use ($uploader) { |
|
| 71 | + $model::retrieved(function($entry) use ($uploader) { |
|
| 72 | 72 | $entry = $uploader->retrieveUploadedFile($entry); |
| 73 | 73 | }); |
| 74 | 74 | |
| 75 | - $model::deleting(function ($entry) use ($uploader) { |
|
| 75 | + $model::deleting(function($entry) use ($uploader) { |
|
| 76 | 76 | $uploader->deleteUploadedFile($entry); |
| 77 | 77 | }); |
| 78 | 78 | |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | * @param array|null $subfield |
| 86 | 86 | * @return void |
| 87 | 87 | */ |
| 88 | - public function registerEvents(array|null $subfield = []) |
|
| 88 | + public function registerEvents(array | null $subfield = []) |
|
| 89 | 89 | { |
| 90 | - if (! empty($subfield)) { |
|
| 90 | + if (!empty($subfield)) { |
|
| 91 | 91 | $this->registerSubfieldEvent($subfield); |
| 92 | 92 | |
| 93 | 93 | return; |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | // for subfields, we only register one event so that we have access to the repeatable container name. |
| 131 | 131 | // all the uploaders for a given container are stored in the UploadersRepository. |
| 132 | - if (! app('UploadersRepository')->hasRepeatableUploadersFor($uploader->getRepeatableContainerName())) { |
|
| 132 | + if (!app('UploadersRepository')->hasRepeatableUploadersFor($uploader->getRepeatableContainerName())) { |
|
| 133 | 133 | $this->setupModelEvents($model, $uploader); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $subfields = collect($this->crudObject->getAttributes()['subfields']); |
| 137 | - $subfields = $subfields->map(function ($item) use ($subfield, $uploader) { |
|
| 137 | + $subfields = $subfields->map(function($item) use ($subfield, $uploader) { |
|
| 138 | 138 | if ($item['name'] === $subfield['name']) { |
| 139 | 139 | $item['upload'] = true; |
| 140 | 140 | $item['disk'] = $uploader->getDisk(); |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | $customUploader = isset($uploaderConfiguration['uploader']) && class_exists($uploaderConfiguration['uploader']); |
| 173 | 173 | |
| 174 | 174 | if ($customUploader) { |
| 175 | - return $uploaderConfiguration['uploader']::for($crudObject, $uploaderConfiguration); |
|
| 175 | + return $uploaderConfiguration['uploader']::for ($crudObject, $uploaderConfiguration); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | $uploader = app('UploadersRepository')->hasUploadFor($crudObject['type'], $this->macro); |
| 179 | 179 | |
| 180 | 180 | if ($uploader) { |
| 181 | - return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for($crudObject, $uploaderConfiguration); |
|
| 181 | + return app('UploadersRepository')->getUploadFor($crudObject['type'], $this->macro)::for ($crudObject, $uploaderConfiguration); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | throw new Exception('Undefined upload type for '.$this->crudObjectType.' type: '.$crudObject['type']); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function markAsHandled(string $objectName) |
| 42 | 42 | { |
| 43 | - if (! in_array($objectName, $this->handledUploaders)) { |
|
| 43 | + if (!in_array($objectName, $this->handledUploaders)) { |
|
| 44 | 44 | $this->handledUploaders[] = $objectName; |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function registerRepeatableUploader(string $uploadName, UploaderInterface $uploader) |
| 114 | 114 | { |
| 115 | - if (! array_key_exists($uploadName, $this->repeatableUploaders) || ! in_array($uploader, $this->repeatableUploaders[$uploadName])) { |
|
| 115 | + if (!array_key_exists($uploadName, $this->repeatableUploaders) || !in_array($uploader, $this->repeatableUploaders[$uploadName])) { |
|
| 116 | 116 | $this->repeatableUploaders[$uploadName][] = $uploader; |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function getRegisteredUploadNames(string $uploadName) |
| 161 | 161 | { |
| 162 | - return array_map(function ($uploader) { |
|
| 162 | + return array_map(function($uploader) { |
|
| 163 | 163 | return $uploader->getName(); |
| 164 | 164 | }, $this->getRepeatableUploadersFor($uploadName)); |
| 165 | 165 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param array $configuration |
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | - public static function for(array $field, array $configuration); |
|
| 40 | + public static function for (array $field, array $configuration); |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * Called to upload a single file. |