We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -3,11 +3,11 @@ |
||
3 | 3 | <?php |
4 | 4 | // if the column has been cast to Carbon or Date (using attribute casting) |
5 | 5 | // get the value as a date string |
6 | - if (! function_exists('formatDate')) { |
|
6 | + if (!function_exists('formatDate')) { |
|
7 | 7 | function formatDate($entry, $dateFieldName) |
8 | 8 | { |
9 | 9 | $formattedDate = null; |
10 | - if (isset($entry) && ! empty($entry->{$dateFieldName})) { |
|
10 | + if (isset($entry) && !empty($entry->{$dateFieldName})) { |
|
11 | 11 | $dateField = $entry->{$dateFieldName}; |
12 | 12 | if ($dateField instanceof \Carbon\CarbonInterface) { |
13 | 13 | $formattedDate = $dateField->format('Y-m-d H:i:s'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | </div> |
38 | 38 | <div class="col-sm-9"> |
39 | 39 | <!-- external link input --> |
40 | - <div class="page_or_link_value page_or_link_external_link <?php if (! isset($entry) || $entry->type != 'external_link') { |
|
40 | + <div class="page_or_link_value page_or_link_external_link <?php if (!isset($entry) || $entry->type != 'external_link') { |
|
41 | 41 | echo 'd-none'; |
42 | 42 | } ?>"> |
43 | 43 | <input |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | > |
57 | 57 | </div> |
58 | 58 | <!-- internal link input --> |
59 | - <div class="page_or_link_value page_or_link_internal_link <?php if (! isset($entry) || $entry->type != 'internal_link') { |
|
59 | + <div class="page_or_link_value page_or_link_internal_link <?php if (!isset($entry) || $entry->type != 'internal_link') { |
|
60 | 60 | echo 'd-none'; |
61 | 61 | } ?>"> |
62 | 62 | <input |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | |
39 | 39 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
40 | 40 | // defined in the main model |
41 | - if (isset($newField['entity']) && ! isset($newField['model'])) { |
|
41 | + if (isset($newField['entity']) && !isset($newField['model'])) { |
|
42 | 42 | $newField['model'] = $this->getRelationModel($newField['entity']); |
43 | 43 | } |
44 | 44 | |
45 | 45 | // if the label is missing, we should set it |
46 | - if (! isset($newField['label'])) { |
|
46 | + if (!isset($newField['label'])) { |
|
47 | 47 | $newField['label'] = mb_ucfirst(str_replace('_', ' ', $newField['name'])); |
48 | 48 | } |
49 | 49 | |
50 | 50 | // if the field type is missing, we should set it |
51 | - if (! isset($newField['type'])) { |
|
51 | + if (!isset($newField['type'])) { |
|
52 | 52 | $newField['type'] = $this->getFieldTypeFromDbColumnType($newField['name']); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // if a tab was mentioned, we should enable it |
56 | 56 | if (isset($newField['tab'])) { |
57 | - if (! $this->tabsEnabled()) { |
|
57 | + if (!$this->tabsEnabled()) { |
|
58 | 58 | $this->enableTabs(); |
59 | 59 | } |
60 | 60 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function afterField($targetFieldName) |
92 | 92 | { |
93 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
93 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
94 | 94 | return $this->moveField($fields, $targetFieldName, false); |
95 | 95 | }); |
96 | 96 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function beforeField($targetFieldName) |
105 | 105 | { |
106 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
106 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
107 | 107 | return $this->moveField($fields, $targetFieldName, true); |
108 | 108 | }); |
109 | 109 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function removeField($name) |
148 | 148 | { |
149 | - $this->transformFields(function ($fields) use ($name) { |
|
149 | + $this->transformFields(function($fields) use ($name) { |
|
150 | 150 | array_forget($fields, $name); |
151 | 151 | |
152 | 152 | return $fields; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function removeFields($array_of_names) |
162 | 162 | { |
163 | - if (! empty($array_of_names)) { |
|
163 | + if (!empty($array_of_names)) { |
|
164 | 164 | foreach ($array_of_names as $name) { |
165 | 165 | $this->removeField($name); |
166 | 166 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function removeAllFields() |
174 | 174 | { |
175 | 175 | $current_fields = $this->getCurrentFields(); |
176 | - if (! empty($current_fields)) { |
|
176 | + if (!empty($current_fields)) { |
|
177 | 177 | foreach ($current_fields as $field) { |
178 | 178 | $this->removeField($field['name']); |
179 | 179 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $jsonCastables = ['array', 'object', 'json']; |
248 | 248 | $fieldCasting = $casted_attributes[$field['name']]; |
249 | 249 | |
250 | - if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) { |
|
250 | + if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) { |
|
251 | 251 | try { |
252 | 252 | $data[$field['name']] = json_decode($data[$field['name']]); |
253 | 253 | } catch (\Exception $e) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function orderFields($order) |
278 | 278 | { |
279 | - $this->transformFields(function ($fields) use ($order) { |
|
279 | + $this->transformFields(function($fields) use ($order) { |
|
280 | 280 | return $this->applyOrderToFields($fields, $order); |
281 | 281 | }); |
282 | 282 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | public function hasUploadFields() |
340 | 340 | { |
341 | 341 | $fields = $this->getFields(); |
342 | - $upload_fields = array_where($fields, function ($value, $key) { |
|
342 | + $upload_fields = array_where($fields, function($value, $key) { |
|
343 | 343 | return isset($value['upload']) && $value['upload'] == true; |
344 | 344 | }); |
345 | 345 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $alreadyLoaded = $this->getLoadedFieldTypes(); |
400 | 400 | $type = $this->getFieldTypeWithNamespace($field); |
401 | 401 | |
402 | - if (! in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
402 | + if (!in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
403 | 403 | $alreadyLoaded[] = $type; |
404 | 404 | $this->setLoadedFieldTypes($alreadyLoaded); |
405 | 405 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | */ |
441 | 441 | public function fieldTypeNotLoaded($field) |
442 | 442 | { |
443 | - return ! in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
443 | + return !in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | /** |
@@ -326,8 +326,6 @@ discard block |
||
326 | 326 | * Check if the create/update form has upload fields. |
327 | 327 | * Upload fields are the ones that have "upload" => true defined on them. |
328 | 328 | * |
329 | - * @param string $form create/update/both - defaults to 'both' |
|
330 | - * @param bool|int $id id of the entity - defaults to false |
|
331 | 329 | * |
332 | 330 | * @return bool |
333 | 331 | */ |
@@ -358,7 +356,7 @@ discard block |
||
358 | 356 | /** |
359 | 357 | * Set an array of field type names as already loaded for the current operation. |
360 | 358 | * |
361 | - * @param array $fieldTypes |
|
359 | + * @param string[] $fieldTypes |
|
362 | 360 | */ |
363 | 361 | public function setLoadedFieldTypes($fieldTypes) |
364 | 362 | { |
@@ -369,7 +367,7 @@ discard block |
||
369 | 367 | * Get a namespaced version of the field type name. |
370 | 368 | * Appends the 'view_namespace' attribute of the field to the `type', using dot notation. |
371 | 369 | * |
372 | - * @param array $field Field array |
|
370 | + * @param string $field Field array |
|
373 | 371 | * @return string Namespaced version of the field type name. Ex: 'text', 'custom.view.path.text' |
374 | 372 | */ |
375 | 373 | public function getFieldTypeWithNamespace($field) |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | |
18 | 18 | public static function bootHasParent() |
19 | 19 | { |
20 | - static::creating(function ($model) { |
|
20 | + static::creating(function($model) { |
|
21 | 21 | if ($model->parentHasHasChildrenTrait()) { |
22 | 22 | $model->forceFill( |
23 | 23 | [$model->getInheritanceColumn() => $model->classToAlias(get_class($model))] |
24 | 24 | ); |
25 | 25 | } |
26 | 26 | }); |
27 | - static::addGlobalScope(function ($query) { |
|
27 | + static::addGlobalScope(function($query) { |
|
28 | 28 | $instance = new static(); |
29 | 29 | if ($instance->parentHasHasChildrenTrait()) { |
30 | 30 | $query->where($instance->getTable().'.'.$instance->getInheritanceColumn(), $instance->classToAlias(get_class($instance))); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function getTable() |
41 | 41 | { |
42 | - if (! isset($this->table)) { |
|
42 | + if (!isset($this->table)) { |
|
43 | 43 | return str_replace('\\', '', snake_case(str_plural(class_basename($this->getParentClass())))); |
44 | 44 | } |
45 | 45 |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | |
34 | 34 | $saveOptions = collect($permissions) |
35 | 35 | // Restrict list to allowed actions. |
36 | - ->filter(function ($action, $permission) { |
|
36 | + ->filter(function($action, $permission) { |
|
37 | 37 | return $this->hasAccess($permission); |
38 | 38 | }) |
39 | 39 | // Generate list of possible actions. |
40 | - ->mapWithKeys(function ($action, $permission) { |
|
40 | + ->mapWithKeys(function($action, $permission) { |
|
41 | 41 | return [$action => $this->getSaveActionButtonName($action)]; |
42 | 42 | }) |
43 | 43 | ->all(); |
@@ -73,8 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function setSaveAction($forceSaveAction = null) |
75 | 75 | { |
76 | - $saveAction = $forceSaveAction ?: |
|
77 | - \Request::input('save_action', $this->getSaveActionDefaultForCurrentOperation()); |
|
76 | + $saveAction = $forceSaveAction ?: \Request::input('save_action', $this->getSaveActionDefaultForCurrentOperation()); |
|
78 | 77 | |
79 | 78 | $showBubble = $this->getOperationSetting('showSaveActionChange') ?? config('backpack.crud.operations.'.$this->getCurrentOperation().'.showSaveActionChange') ?? true; |
80 | 79 |
@@ -127,7 +127,7 @@ |
||
127 | 127 | |
128 | 128 | case 'boolean': |
129 | 129 | return 'boolean'; |
130 | - break; |
|
130 | + break; |
|
131 | 131 | |
132 | 132 | case 'tinyint': |
133 | 133 | return 'active'; |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function setFromDb() |
14 | 14 | { |
15 | - if (! $this->driverIsMongoDb()) { |
|
15 | + if (!$this->driverIsMongoDb()) { |
|
16 | 16 | $this->setDoctrineTypesMapping(); |
17 | 17 | $this->getDbColumnTypes(); |
18 | 18 | } |
19 | 19 | |
20 | - array_map(function ($field) { |
|
20 | + array_map(function($field) { |
|
21 | 21 | $new_field = [ |
22 | 22 | 'name' => $field, |
23 | 23 | 'label' => $this->makeLabel($field), |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | 'autoset' => true, |
30 | 30 | ]; |
31 | 31 | |
32 | - if (! isset($this->fields()[$field])) { |
|
32 | + if (!isset($this->fields()[$field])) { |
|
33 | 33 | $this->addField($new_field); |
34 | 34 | } |
35 | 35 | |
36 | - if (! in_array($field, $this->model->getHidden()) && ! in_array($field, $this->columns())) { |
|
36 | + if (!in_array($field, $this->model->getHidden()) && !in_array($field, $this->columns())) { |
|
37 | 37 | $this->addColumn([ |
38 | 38 | 'name' => $field, |
39 | 39 | 'label' => $this->makeLabel($field), |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $types = ['enum' => 'string']; |
172 | 172 | $platform = $this->getSchema()->getConnection()->getDoctrineConnection()->getDatabasePlatform(); |
173 | 173 | foreach ($types as $type_key => $type_value) { |
174 | - if (! $platform->hasDoctrineTypeMappingFor($type_key)) { |
|
174 | + if (!$platform->hasDoctrineTypeMappingFor($type_key)) { |
|
175 | 175 | $platform->registerDoctrineTypeMapping($type_key, $type_value); |
176 | 176 | } |
177 | 177 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | // Automatically-set columns should be both in the database, and in the $fillable variable on the Eloquent Model |
231 | 231 | $columns = $this->model->getConnection()->getSchemaBuilder()->getColumnListing($this->model->getTable()); |
232 | 232 | |
233 | - if (! empty($fillable)) { |
|
233 | + if (!empty($fillable)) { |
|
234 | 234 | $columns = array_intersect($columns, $fillable); |
235 | 235 | } |
236 | 236 | } |
@@ -29,11 +29,11 @@ |
||
29 | 29 | { |
30 | 30 | $this->crud->allowAccess('delete'); |
31 | 31 | |
32 | - $this->crud->operation('delete', function () { |
|
32 | + $this->crud->operation('delete', function() { |
|
33 | 33 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
34 | 34 | }); |
35 | 35 | |
36 | - $this->crud->operation(['list', 'show'], function () { |
|
36 | + $this->crud->operation(['list', 'show'], function() { |
|
37 | 37 | $this->crud->addButton('line', 'delete', 'view', 'crud::buttons.delete', 'end'); |
38 | 38 | }); |
39 | 39 | } |
@@ -30,11 +30,11 @@ |
||
30 | 30 | $this->crud->allowAccess('show'); |
31 | 31 | $this->crud->setOperationSetting('setFromDb', true); |
32 | 32 | |
33 | - $this->crud->operation('show', function () { |
|
33 | + $this->crud->operation('show', function() { |
|
34 | 34 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
35 | 35 | }); |
36 | 36 | |
37 | - $this->crud->operation('list', function () { |
|
37 | + $this->crud->operation('list', function() { |
|
38 | 38 | $this->crud->addButton('line', 'show', 'view', 'crud::buttons.show', 'beginning'); |
39 | 39 | }); |
40 | 40 | } |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | // allow access to the operation |
37 | 37 | $this->crud->allowAccess('revisions'); |
38 | 38 | |
39 | - $this->crud->operation('revisions', function () { |
|
39 | + $this->crud->operation('revisions', function() { |
|
40 | 40 | $this->crud->loadDefaultOperationSettingsFromConfig(); |
41 | 41 | }); |
42 | 42 | |
43 | - $this->crud->operation(['list', 'show'], function () { |
|
43 | + $this->crud->operation(['list', 'show'], function() { |
|
44 | 44 | // add a button in the line stack |
45 | 45 | $this->crud->addButton('line', 'revisions', 'view', 'crud::buttons.revisions', 'end'); |
46 | 46 | }); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->crud->hasAccessOrFail('revisions'); |
89 | 89 | |
90 | 90 | $revisionId = \Request::input('revision_id', false); |
91 | - if (! $revisionId) { |
|
91 | + if (!$revisionId) { |
|
92 | 92 | abort(500, 'Can\'t restore revision without revision_id'); |
93 | 93 | } else { |
94 | 94 | $this->crud->restoreRevision($id, $revisionId); // do the update |