We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | (array) config('backpack.base.middleware_key', 'admin'), |
| 16 | 16 | 'prefix' => config('backpack.base.route_prefix', 'admin'), |
| 17 | 17 | ], |
| 18 | - function () { |
|
| 18 | + function() { |
|
| 19 | 19 | Route::crud('users', 'Backpack\CRUD\Tests\Config\Http\Controllers\UserCrudController'); |
| 20 | 20 | } |
| 21 | 21 | ); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Registering package commands. |
| 143 | - if (! empty($this->commands)) { |
|
| 143 | + if (!empty($this->commands)) { |
|
| 144 | 144 | $this->commands($this->commands); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | protected function packageDirectoryExistsAndIsNotEmpty($name) |
| 236 | 236 | { |
| 237 | 237 | // check if directory exists |
| 238 | - if (! is_dir($this->getPath().'/'.$name)) { |
|
| 238 | + if (!is_dir($this->getPath().'/'.$name)) { |
|
| 239 | 239 | return false; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | // Install Backpack Generators |
| 85 | 85 | $this->progressBlock('Installing Generators'); |
| 86 | - if (! file_exists('vendor/backpack/generators/composer.json')) { |
|
| 86 | + if (!file_exists('vendor/backpack/generators/composer.json')) { |
|
| 87 | 87 | // only do this if Generators aren't already required |
| 88 | 88 | $process = new Process(['composer', 'require', '--dev', 'backpack/generators']); |
| 89 | 89 | $process->setTimeout(300); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $this->closeProgressBlock(); |
| 98 | 98 | |
| 99 | 99 | // Optional commands |
| 100 | - if (! $this->option('no-interaction')) { |
|
| 100 | + if (!$this->option('no-interaction')) { |
|
| 101 | 101 | // Themes |
| 102 | 102 | $this->installTheme(); |
| 103 | 103 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // Addons |
| 108 | 108 | $this->installAddons(); |
| 109 | - } elseif (! $this->isAnyThemeInstalled()) { |
|
| 109 | + } elseif (!$this->isAnyThemeInstalled()) { |
|
| 110 | 110 | // Install default theme |
| 111 | 111 | $this->progressBlock('Installing default theme'); |
| 112 | 112 | $this->executeArtisanProcess('backpack:require:theme-coreuiv2'); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | $this->deleteLines(3); |
| 189 | 189 | |
| 190 | - if (! $total) { |
|
| 190 | + if (!$total) { |
|
| 191 | 191 | $this->deleteLines(); |
| 192 | 192 | $this->note('Skipping creating an admin user.'); |
| 193 | 193 | $this->newLine(); |
@@ -196,14 +196,14 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | private function isEveryAddonInstalled() |
| 198 | 198 | { |
| 199 | - return collect($this->addons)->every(function ($addon) { |
|
| 199 | + return collect($this->addons)->every(function($addon) { |
|
| 200 | 200 | return file_exists($addon->path); |
| 201 | 201 | }); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | private function updateAddonsStatus() |
| 205 | 205 | { |
| 206 | - $this->addons = $this->addons->each(function (&$addon) { |
|
| 206 | + $this->addons = $this->addons->each(function(&$addon) { |
|
| 207 | 207 | $isInstalled = file_exists($addon->path); |
| 208 | 208 | $addon->status = $isInstalled ? 'installed' : 'not installed'; |
| 209 | 209 | $addon->statusColor = $isInstalled ? 'green' : 'yellow'; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | { |
| 215 | 215 | // map the addons |
| 216 | 216 | $this->addons = collect($this->addons) |
| 217 | - ->map(function ($class) { |
|
| 217 | + ->map(function($class) { |
|
| 218 | 218 | return (object) $class::$addon; |
| 219 | 219 | }); |
| 220 | 220 | |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | // Calculate the printed line count |
| 235 | 235 | $printedLines = $this->addons |
| 236 | - ->map(function ($e) { |
|
| 236 | + ->map(function($e) { |
|
| 237 | 237 | return count($e->description); |
| 238 | 238 | }) |
| 239 | - ->reduce(function ($sum, $item) { |
|
| 239 | + ->reduce(function($sum, $item) { |
|
| 240 | 240 | return $sum + $item + 2; |
| 241 | 241 | }, 0); |
| 242 | 242 | |
| 243 | 243 | $total = 0; |
| 244 | - while (! $this->isEveryAddonInstalled()) { |
|
| 244 | + while (!$this->isEveryAddonInstalled()) { |
|
| 245 | 245 | $input = (int) $this->listChoice('Would you like to install a premium Backpack add-on? <fg=gray>(enter option number: 1, 2 or 3)</>', $this->addons->toArray()); |
| 246 | 246 | |
| 247 | 247 | if ($input < 1 || $input > $this->addons->count()) { |
@@ -276,14 +276,14 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | private function isEveryThemeInstalled() |
| 278 | 278 | { |
| 279 | - return $this->themes()->every(function ($theme) { |
|
| 279 | + return $this->themes()->every(function($theme) { |
|
| 280 | 280 | return $theme->status == 'installed'; |
| 281 | 281 | }); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | private function isAnyThemeInstalled() |
| 285 | 285 | { |
| 286 | - return $this->themes()->filter(function ($theme) { |
|
| 286 | + return $this->themes()->filter(function($theme) { |
|
| 287 | 287 | return $theme->status == 'installed'; |
| 288 | 288 | })->count() > 0; |
| 289 | 289 | } |
@@ -301,10 +301,10 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | // Calculate the printed line count |
| 303 | 303 | $printedLines = $this->themes() |
| 304 | - ->map(function ($e) { |
|
| 304 | + ->map(function($e) { |
|
| 305 | 305 | return count($e->description); |
| 306 | 306 | }) |
| 307 | - ->reduce(function ($sum, $item) { |
|
| 307 | + ->reduce(function($sum, $item) { |
|
| 308 | 308 | return $sum + $item + 2; |
| 309 | 309 | }, 0); |
| 310 | 310 | |
@@ -340,9 +340,9 @@ discard block |
||
| 340 | 340 | public function themes() |
| 341 | 341 | { |
| 342 | 342 | return collect($this->themes) |
| 343 | - ->map(function ($class) { |
|
| 343 | + ->map(function($class) { |
|
| 344 | 344 | return (object) $class::$addon; |
| 345 | - })->each(function (&$theme) { |
|
| 345 | + })->each(function(&$theme) { |
|
| 346 | 346 | $isInstalled = file_exists($theme->path); |
| 347 | 347 | $theme->status = $isInstalled ? 'installed' : 'not installed'; |
| 348 | 348 | $theme->statusColor = $isInstalled ? 'green' : 'yellow'; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $this->progressBlock("Adding menu entry to <fg=blue>$path</>"); |
| 50 | 50 | |
| 51 | 51 | // Validate file exists |
| 52 | - if (! $disk->exists($path)) { |
|
| 52 | + if (!$disk->exists($path)) { |
|
| 53 | 53 | $this->errorProgressBlock(); |
| 54 | 54 | $this->note('The menu_items file does not exist. Make sure Backpack is properly installed.', 'red'); |
| 55 | 55 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (! $disk->put($path, $contents.PHP_EOL.$code)) { |
|
| 69 | + if (!$disk->put($path, $contents.PHP_EOL.$code)) { |
|
| 70 | 70 | $this->errorProgressBlock(); |
| 71 | 71 | $this->note('Could not write to menu_items file.', 'red'); |
| 72 | 72 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | private function getLastLineNumberThatContains($needle, $haystack) |
| 87 | 87 | { |
| 88 | - $matchingLines = array_filter($haystack, function ($k) use ($needle) { |
|
| 88 | + $matchingLines = array_filter($haystack, function($k) use ($needle) { |
|
| 89 | 89 | return strpos($k, $needle) !== false; |
| 90 | 90 | }); |
| 91 | 91 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Display general error in case it failed |
| 74 | - if (! $this->isInstalled()) { |
|
| 74 | + if (!$this->isInstalled()) { |
|
| 75 | 75 | $this->errorProgressBlock(); |
| 76 | 76 | $this->note('For further information please check the log file.'); |
| 77 | 77 | $this->note('You can also follow the manual installation process documented on Github.'); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $this->progressBlock('Publish theme config file'); |
| 85 | 85 | |
| 86 | 86 | // manually include the provider in the run-time |
| 87 | - if (! class_exists(self::$addon['provider'])) { |
|
| 87 | + if (!class_exists(self::$addon['provider'])) { |
|
| 88 | 88 | include self::$addon['provider_path'] ?? self::$addon['path'].'/src/AddonServiceProvider.php'; |
| 89 | 89 | app()->register(self::$addon['provider']); |
| 90 | 90 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function subfields($subfields) |
| 228 | 228 | { |
| 229 | - $callAttributeMacro = ! isset($this->attributes['subfields']); |
|
| 229 | + $callAttributeMacro = !isset($this->attributes['subfields']); |
|
| 230 | 230 | $this->attributes['subfields'] = $subfields; |
| 231 | 231 | $this->attributes = $this->crud()->makeSureFieldHasNecessaryAttributes($this->attributes); |
| 232 | 232 | if ($callAttributeMacro) { |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | // append the field name to the rule name of validationMessages array. |
| 277 | 277 | // eg: ['required => 'This field is required'] |
| 278 | 278 | // will be transformed into: ['field_name.required' => 'This field is required] |
| 279 | - $this->crud()->setValidationFromArray([], array_merge(...array_map(function ($rule, $message) { |
|
| 279 | + $this->crud()->setValidationFromArray([], array_merge(...array_map(function($rule, $message) { |
|
| 280 | 280 | return [$this->attributes['name'].'.'.$rule => $message]; |
| 281 | 281 | }, array_keys($messages), $messages))); |
| 282 | 282 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | private function getViewPathsWithFallbacks() |
| 300 | 300 | { |
| 301 | 301 | $type = $this->name; |
| 302 | - $paths = array_map(function ($item) use ($type) { |
|
| 302 | + $paths = array_map(function($item) use ($type) { |
|
| 303 | 303 | return $item.'.'.$type; |
| 304 | 304 | }, ViewNamespaces::getFor('buttons')); |
| 305 | 305 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | |
| 468 | 468 | $itemExists = $this->collection()->contains('name', $this->name); |
| 469 | 469 | |
| 470 | - if (! $itemExists) { |
|
| 470 | + if (!$itemExists) { |
|
| 471 | 471 | $this->crud()->addCrudButton($this); |
| 472 | 472 | if ($this->position == 'beginning') { |
| 473 | 473 | $this->before($this->collection()->first()->name); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | return ['name' => $field]; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if (is_array($field) && ! isset($field['name'])) { |
|
| 118 | + if (is_array($field) && !isset($field['name'])) { |
|
| 119 | 119 | abort(500, 'All fields must have their name defined'); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | // if there's a model defined, but no attribute |
| 189 | 189 | // guess an attribute using the identifiableAttribute functionality in CrudTrait |
| 190 | - if (isset($field['model']) && ! isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) { |
|
| 190 | + if (isset($field['model']) && !isset($field['attribute']) && method_exists($field['model'], 'identifiableAttribute')) { |
|
| 191 | 191 | $field['attribute'] = (new $field['model']())->identifiableAttribute(); |
| 192 | 192 | } |
| 193 | 193 | |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | protected function makeSureFieldHasLabel($field) |
| 205 | 205 | { |
| 206 | - if (! isset($field['label'])) { |
|
| 206 | + if (!isset($field['label'])) { |
|
| 207 | 207 | $name = str_replace(',', ' ', $field['name']); |
| 208 | 208 | $name = str_replace('_id', '', $name); |
| 209 | 209 | $field['label'] = mb_ucfirst(str_replace('_', ' ', $name)); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | protected function makeSureFieldHasType($field) |
| 223 | 223 | { |
| 224 | - if (! isset($field['type'])) { |
|
| 224 | + if (!isset($field['type'])) { |
|
| 225 | 225 | $field['type'] = isset($field['relation_type']) ? $this->inferFieldTypeFromRelationType($field['relation_type']) : $this->inferFieldTypeFromDbColumnType($field['name']); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -254,12 +254,12 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | protected function makeSureSubfieldsHaveNecessaryAttributes($field) |
| 256 | 256 | { |
| 257 | - if (! isset($field['subfields'])) { |
|
| 257 | + if (!isset($field['subfields'])) { |
|
| 258 | 258 | return $field; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | foreach ($field['subfields'] as $key => $subfield) { |
| 262 | - if (empty($subfield) || ! isset($subfield['name'])) { |
|
| 262 | + if (empty($subfield) || !isset($subfield['name'])) { |
|
| 263 | 263 | abort(500, 'Subfield name can\'t be empty'); |
| 264 | 264 | } |
| 265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | $subfield['parentFieldName'] = $field['name']; |
| 272 | 272 | |
| 273 | - if (! isset($field['model'])) { |
|
| 273 | + if (!isset($field['model'])) { |
|
| 274 | 274 | // we're inside a simple 'repeatable' with no model/relationship, so |
| 275 | 275 | // we assume all subfields are supposed to be text fields |
| 276 | 276 | $subfield['type'] = $subfield['type'] ?? 'text'; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | { |
| 325 | 325 | // if a tab was mentioned, we should enable it |
| 326 | 326 | if (isset($field['tab'])) { |
| 327 | - if (! $this->tabsEnabled()) { |
|
| 327 | + if (!$this->tabsEnabled()) { |
|
| 328 | 328 | $this->enableTabs(); |
| 329 | 329 | } |
| 330 | 330 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function afterField($targetFieldName) |
| 138 | 138 | { |
| 139 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
| 139 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
| 140 | 140 | return $this->moveField($fields, $targetFieldName, false); |
| 141 | 141 | }); |
| 142 | 142 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function beforeField($targetFieldName) |
| 150 | 150 | { |
| 151 | - $this->transformFields(function ($fields) use ($targetFieldName) { |
|
| 151 | + $this->transformFields(function($fields) use ($targetFieldName) { |
|
| 152 | 152 | return $this->moveField($fields, $targetFieldName, true); |
| 153 | 153 | }); |
| 154 | 154 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function makeFirstField() |
| 162 | 162 | { |
| 163 | - if (! $this->fields()) { |
|
| 163 | + if (!$this->fields()) { |
|
| 164 | 164 | return false; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function removeField($name) |
| 177 | 177 | { |
| 178 | - $this->transformFields(function ($fields) use ($name) { |
|
| 178 | + $this->transformFields(function($fields) use ($name) { |
|
| 179 | 179 | Arr::forget($fields, $name); |
| 180 | 180 | |
| 181 | 181 | return $fields; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function removeFields($array_of_names) |
| 191 | 191 | { |
| 192 | - if (! empty($array_of_names)) { |
|
| 192 | + if (!empty($array_of_names)) { |
|
| 193 | 193 | foreach ($array_of_names as $name) { |
| 194 | 194 | $this->removeField($name); |
| 195 | 195 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | public function removeAllFields() |
| 203 | 203 | { |
| 204 | 204 | $current_fields = $this->getCleanStateFields(); |
| 205 | - if (! empty($current_fields)) { |
|
| 205 | + if (!empty($current_fields)) { |
|
| 206 | 206 | foreach ($current_fields as $field) { |
| 207 | 207 | $this->removeField($field['name']); |
| 208 | 208 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | $jsonCastables = ['array', 'object', 'json']; |
| 297 | 297 | $fieldCasting = $casted_attributes[$field['name']]; |
| 298 | 298 | |
| 299 | - if (in_array($fieldCasting, $jsonCastables) && isset($input[$field['name']]) && ! empty($input[$field['name']]) && ! is_array($input[$field['name']])) { |
|
| 299 | + if (in_array($fieldCasting, $jsonCastables) && isset($input[$field['name']]) && !empty($input[$field['name']]) && !is_array($input[$field['name']])) { |
|
| 300 | 300 | try { |
| 301 | 301 | $input[$field['name']] = json_decode($input[$field['name']]); |
| 302 | 302 | } catch (\Exception $e) { |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public function orderFields($order) |
| 327 | 327 | { |
| 328 | - $this->transformFields(function ($fields) use ($order) { |
|
| 328 | + $this->transformFields(function($fields) use ($order) { |
|
| 329 | 329 | return $this->applyOrderToFields($fields, $order); |
| 330 | 330 | }); |
| 331 | 331 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | public function hasUploadFields() |
| 350 | 350 | { |
| 351 | 351 | $fields = $this->getCleanStateFields(); |
| 352 | - $upload_fields = Arr::where($fields, function ($value, $key) { |
|
| 352 | + $upload_fields = Arr::where($fields, function($value, $key) { |
|
| 353 | 353 | // check if any subfields have uploads |
| 354 | 354 | if (isset($value['subfields'])) { |
| 355 | 355 | foreach ($value['subfields'] as $subfield) { |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $alreadyLoaded = $this->getLoadedFieldTypes(); |
| 422 | 422 | $type = $this->getFieldTypeWithNamespace($field); |
| 423 | 423 | |
| 424 | - if (! in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
| 424 | + if (!in_array($type, $this->getLoadedFieldTypes(), true)) { |
|
| 425 | 425 | $alreadyLoaded[] = $type; |
| 426 | 426 | $this->setLoadedFieldTypes($alreadyLoaded); |
| 427 | 427 | |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | */ |
| 463 | 463 | public function fieldTypeNotLoaded($field) |
| 464 | 464 | { |
| 465 | - return ! in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
| 465 | + return !in_array($this->getFieldTypeWithNamespace($field), $this->getLoadedFieldTypes()); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | { |
| 475 | 475 | $fieldNamesArray = array_column($this->getCleanStateFields(), 'name'); |
| 476 | 476 | |
| 477 | - return array_reduce($fieldNamesArray, function ($names, $item) { |
|
| 477 | + return array_reduce($fieldNamesArray, function($names, $item) { |
|
| 478 | 478 | if (strpos($item, ',') === false) { |
| 479 | 479 | $names[] = $item; |
| 480 | 480 | |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | */ |
| 526 | 526 | public function hasFieldWhere($attribute, $value) |
| 527 | 527 | { |
| 528 | - $match = Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) { |
|
| 528 | + $match = Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) { |
|
| 529 | 529 | return isset($field[$attribute]) && $field[$attribute] == $value; |
| 530 | 530 | }); |
| 531 | 531 | |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | */ |
| 542 | 542 | public function firstFieldWhere($attribute, $value) |
| 543 | 543 | { |
| 544 | - return Arr::first($this->getCleanStateFields(), function ($field, $fieldKey) use ($attribute, $value) { |
|
| 544 | + return Arr::first($this->getCleanStateFields(), function($field, $fieldKey) use ($attribute, $value) { |
|
| 545 | 545 | return isset($field[$attribute]) && $field[$attribute] == $value; |
| 546 | 546 | }); |
| 547 | 547 | } |