Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — operation-hooks ( b4d208...da52e4 )
by Pedro
11:38
created
src/BackpackServiceProvider.php 1 patch
Spacing   +14 added lines, -16 removed lines patch added patch discarded remove patch
@@ -83,28 +83,28 @@  discard block
 block discarded – undo
83 83
         $this->registerBackpackErrorViews();
84 84
 
85 85
         // Bind the CrudPanel object to Laravel's service container
86
-        $this->app->scoped('crud', function ($app) {
86
+        $this->app->scoped('crud', function($app) {
87 87
             return new CrudPanel();
88 88
         });
89 89
 
90
-        $this->app->scoped('DatabaseSchema', function ($app) {
90
+        $this->app->scoped('DatabaseSchema', function($app) {
91 91
             return new DatabaseSchema();
92 92
         });
93 93
 
94
-        $this->app->scoped('lifecycle-hook', function ($app) {
94
+        $this->app->scoped('lifecycle-hook', function($app) {
95 95
             return new app\Library\CrudPanel\Hooks\LifecycleHooks();
96 96
         });
97 97
 
98
-        $this->app->singleton('BackpackViewNamespaces', function ($app) {
98
+        $this->app->singleton('BackpackViewNamespaces', function($app) {
99 99
             return new ViewNamespaces();
100 100
         });
101 101
 
102 102
         // Bind the widgets collection object to Laravel's service container
103
-        $this->app->singleton('widgets', function ($app) {
103
+        $this->app->singleton('widgets', function($app) {
104 104
             return new Collection();
105 105
         });
106 106
 
107
-        $this->app->scoped('UploadersRepository', function ($app) {
107
+        $this->app->scoped('UploadersRepository', function($app) {
108 108
             return new UploadersRepository();
109 109
         });
110 110
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $middleware_key = config('backpack.base.middleware_key');
121 121
         $middleware_class = config('backpack.base.middleware_class');
122 122
 
123
-        if (! is_array($middleware_class)) {
123
+        if (!is_array($middleware_class)) {
124 124
             $router->pushMiddlewareToGroup($middleware_key, $middleware_class);
125 125
 
126 126
             return;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
         $configs = scandir(__DIR__."/config/backpack/$dir/");
236 236
         $configs = array_diff($configs, ['.', '..']);
237 237
 
238
-        if (! count($configs)) {
238
+        if (!count($configs)) {
239 239
             return;
240 240
         }
241 241
 
@@ -284,8 +284,7 @@  discard block
 block discarded – undo
284 284
         // add the backpack_users password broker to the configuration
285 285
         $laravelAuthPasswordBrokers = app()->config['auth.passwords'];
286 286
         $laravelFirstPasswordBroker = is_array($laravelAuthPasswordBrokers) && current($laravelAuthPasswordBrokers) ?
287
-                                        current($laravelAuthPasswordBrokers)['table'] :
288
-                                        '';
287
+                                        current($laravelAuthPasswordBrokers)['table'] : '';
289 288
 
290 289
         $backpackPasswordBrokerTable = config('backpack.base.password_resets_table') ??
291 290
                                         config('auth.passwords.users.table') ??
@@ -313,7 +312,7 @@  discard block
 block discarded – undo
313 312
 
314 313
     public function loadViewComponents()
315 314
     {
316
-        $this->app->afterResolving(BladeCompiler::class, function () {
315
+        $this->app->afterResolving(BladeCompiler::class, function() {
317 316
             Blade::componentNamespace('Backpack\\CRUD\\app\\View\\Components', 'backpack');
318 317
         });
319 318
     }
@@ -339,13 +338,13 @@  discard block
 block discarded – undo
339 338
     private function registerBackpackErrorViews()
340 339
     {
341 340
         // register the backpack error when the exception handler is resolved from the container
342
-        $this->callAfterResolving(ExceptionHandler::class, function ($handler) {
343
-            if (! Str::startsWith(request()->path(), config('backpack.base.route_prefix'))) {
341
+        $this->callAfterResolving(ExceptionHandler::class, function($handler) {
342
+            if (!Str::startsWith(request()->path(), config('backpack.base.route_prefix'))) {
344 343
                 return;
345 344
             }
346 345
 
347 346
             // parse the namespaces set in config
348
-            [$themeNamespace, $themeFallbackNamespace] = (function () {
347
+            [$themeNamespace, $themeFallbackNamespace] = (function() {
349 348
                 $themeNamespace = config('backpack.ui.view_namespace');
350 349
                 $themeFallbackNamespace = config('backpack.ui.view_namespace_fallback');
351 350
 
@@ -362,8 +361,7 @@  discard block
 block discarded – undo
362 361
             // - fallback theme paths
363 362
             // - ui path
364 363
             $themeErrorPaths = $viewFinderHints[$themeNamespace] ?? [];
365
-            $themeErrorPaths = $themeNamespace === $themeFallbackNamespace ? $themeErrorPaths :
366
-                array_merge($viewFinderHints[$themeFallbackNamespace] ?? [], $themeErrorPaths);
364
+            $themeErrorPaths = $themeNamespace === $themeFallbackNamespace ? $themeErrorPaths : array_merge($viewFinderHints[$themeFallbackNamespace] ?? [], $themeErrorPaths);
367 365
             $uiErrorPaths = [base_path('vendor/backpack/crud/src/resources/views/ui')];
368 366
             $themeErrorPaths = array_merge($themeErrorPaths, $uiErrorPaths);
369 367
 
Please login to merge, or discard this patch.
src/app/Http/Controllers/Operations/ShowOperation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@
 block discarded – undo
31 31
         $this->crud->allowAccess('show');
32 32
         $this->crud->setOperationSetting('setFromDb', true);
33 33
 
34
-        LifecycleHook::hookInto('show:before_setup', function () {
34
+        LifecycleHook::hookInto('show:before_setup', function() {
35 35
             $this->crud->loadDefaultOperationSettingsFromConfig();
36 36
 
37
-            if (! method_exists($this, 'setupShowOperation')) {
37
+            if (!method_exists($this, 'setupShowOperation')) {
38 38
                 $this->autoSetupShowOperation();
39 39
             }
40 40
         });
41 41
 
42
-        LifecycleHook::hookInto(['list:before_setup'], function () {
42
+        LifecycleHook::hookInto(['list:before_setup'], function() {
43 43
             $this->crud->addButton('line', 'show', 'view', 'crud::buttons.show', 'beginning');
44 44
         });
45 45
 
46
-        LifecycleHook::hookInto(['create:before_setup', 'update:before_setup'], function () {
46
+        LifecycleHook::hookInto(['create:before_setup', 'update:before_setup'], function() {
47 47
             $this->crud->addSaveAction([
48 48
                 'name' => 'save_and_preview',
49
-                'visible' => function ($crud) {
49
+                'visible' => function($crud) {
50 50
                     return $crud->hasAccess('show');
51 51
                 },
52
-                'redirect' => function ($crud, $request, $itemId = null) {
52
+                'redirect' => function($crud, $request, $itemId = null) {
53 53
                     $itemId = $itemId ?: $request->input('id');
54 54
                     $redirectUrl = $crud->route.'/'.$itemId.'/show';
55 55
                     if ($request->has('_locale')) {
Please login to merge, or discard this patch.
src/app/Http/Controllers/Operations/UpdateOperation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $this->crud->allowAccess('update');
38 38
 
39
-        LifecycleHook::hookInto('update:before_setup', function () {
39
+        LifecycleHook::hookInto('update:before_setup', function() {
40 40
             $this->crud->loadDefaultOperationSettingsFromConfig();
41 41
 
42 42
             if ($this->crud->getModel()->translationEnabled()) {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             $this->crud->setupDefaultSaveActions();
51 51
         });
52 52
 
53
-        LifecycleHook::hookInto(['list:before_setup', 'show:before_setup'], function () {
53
+        LifecycleHook::hookInto(['list:before_setup', 'show:before_setup'], function() {
54 54
             $this->crud->addButton('line', 'update', 'view', 'crud::buttons.update', 'end');
55 55
         });
56 56
     }
Please login to merge, or discard this patch.
src/app/Http/Controllers/Operations/ReorderOperation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $this->crud->set('reorder.enabled', true);
38 38
         $this->crud->allowAccess('reorder');
39 39
 
40
-        LifecycleHook::hookInto('reorder:before_setup', function () {
40
+        LifecycleHook::hookInto('reorder:before_setup', function() {
41 41
             $this->crud->loadDefaultOperationSettingsFromConfig();
42 42
             $this->crud->setOperationSetting('reorderColumnNames', [
43 43
                 'parent_id' => 'parent_id',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             ]);
48 48
         });
49 49
 
50
-        LifecycleHook::hookInto('list:before_setup', function () {
50
+        LifecycleHook::hookInto('list:before_setup', function() {
51 51
             $this->crud->addButton('top', 'reorder', 'view', 'crud::buttons.reorder');
52 52
         });
53 53
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $this->crud->hasAccessOrFail('reorder');
65 65
 
66
-        if (! $this->crud->isReorderEnabled()) {
66
+        if (!$this->crud->isReorderEnabled()) {
67 67
             abort(403, 'Reorder is disabled.');
68 68
         }
69 69
 
Please login to merge, or discard this patch.
src/app/Http/Controllers/Operations/DeleteOperation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
     {
31 31
         $this->crud->allowAccess('delete');
32 32
 
33
-        LifecycleHook::hookInto('delete:before_setup', function () {
33
+        LifecycleHook::hookInto('delete:before_setup', function() {
34 34
             $this->crud->loadDefaultOperationSettingsFromConfig();
35 35
         });
36 36
 
37
-        LifecycleHook::hookInto(['list:before_setup', 'show:before_setup'], function () {
37
+        LifecycleHook::hookInto(['list:before_setup', 'show:before_setup'], function() {
38 38
             $this->crud->addButton('line', 'delete', 'view', 'crud::buttons.delete', 'end');
39 39
         });
40 40
     }
Please login to merge, or discard this patch.
src/app/Http/Controllers/Operations/Concerns/HasForm.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         // Access
40 40
         $this->crud->allowAccess($operationName);
41 41
 
42
-        LifecycleHook::hookInto($operationName.':before_setup', function () use ($operationName) {
42
+        LifecycleHook::hookInto($operationName.':before_setup', function() use ($operationName) {
43 43
             // if the backpack.operations.{operationName} config exists, use that one
44 44
             // otherwise, use the generic backpack.operations.form config
45 45
             if (config()->has('backpack.operations.'.$operationName)) {
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
             // add a reasonable "save and back" save action
52 52
             $this->crud->addSaveAction([
53 53
                 'name' => 'save_and_back',
54
-                'visible' => function ($crud) use ($operationName) {
54
+                'visible' => function($crud) use ($operationName) {
55 55
                     return $crud->hasAccess($operationName);
56 56
                 },
57
-                'redirect' => function ($crud, $request, $itemId = null) {
57
+                'redirect' => function($crud, $request, $itemId = null) {
58 58
                     return $request->request->has('_http_referrer') ? $request->request->get('_http_referrer') : $crud->route;
59 59
                 },
60 60
                 'button_text' => trans('backpack::crud.save_action_save_and_back'),
61 61
             ]);
62 62
         });
63 63
 
64
-        LifecycleHook::hookInto(['list:before_setup', 'show:before_setup'], function () use ($operationName, $buttonStack, $buttonMeta) {
64
+        LifecycleHook::hookInto(['list:before_setup', 'show:before_setup'], function() use ($operationName, $buttonStack, $buttonMeta) {
65 65
             $this->crud->button($operationName)->view('crud::buttons.quick')->stack($buttonStack)->meta($buttonMeta);
66 66
         });
67 67
     }
Please login to merge, or discard this patch.
src/app/Library/CrudPanel/Hooks/LifecycleHooks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 {
7 7
     public array $hooks = [];
8 8
 
9
-    public function hookInto(string|array $hooks, callable $callback): void
9
+    public function hookInto(string | array $hooks, callable $callback): void
10 10
     {
11 11
         $hooks = is_array($hooks) ? $hooks : [$hooks];
12 12
         foreach ($hooks as $hook) {
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
         }
15 15
     }
16 16
 
17
-    public function trigger(string|array $hooks, array $parameters = []): void
17
+    public function trigger(string | array $hooks, array $parameters = []): void
18 18
     {
19 19
         $hooks = is_array($hooks) ? $hooks : [$hooks];
20 20
         foreach ($hooks as $hook) {
Please login to merge, or discard this patch.
src/macros.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
34 34
         return $result;
35 35
     });
36 36
 }
37
-if (! CrudColumn::hasMacro('withFiles')) {
38
-    CrudColumn::macro('withFiles', function ($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) {
37
+if (!CrudColumn::hasMacro('withFiles')) {
38
+    CrudColumn::macro('withFiles', function($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) {
39 39
         /** @var CrudColumn $this */
40 40
         $uploadDefinition = is_array($uploadDefinition) ? $uploadDefinition : [];
41 41
         $this->setAttributeValue('withFiles', $uploadDefinition);
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     });
47 47
 }
48 48
 
49
-if (! CrudField::hasMacro('withFiles')) {
50
-    CrudField::macro('withFiles', function ($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) {
49
+if (!CrudField::hasMacro('withFiles')) {
50
+    CrudField::macro('withFiles', function($uploadDefinition = [], $subfield = null, $registerUploaderEvents = true) {
51 51
         /** @var CrudField $this */
52 52
         $uploadDefinition = is_array($uploadDefinition) ? $uploadDefinition : [];
53 53
         $this->setAttributeValue('withFiles', $uploadDefinition);
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
     });
59 59
 }
60 60
 
61
-if (! CrudColumn::hasMacro('linkTo')) {
62
-    CrudColumn::macro('linkTo', function (string|array|Closure $routeOrConfiguration, ?array $parameters = []): static {
61
+if (!CrudColumn::hasMacro('linkTo')) {
62
+    CrudColumn::macro('linkTo', function(string | array | Closure $routeOrConfiguration, ?array $parameters = []): static {
63 63
         $wrapper = $this->attributes['wrapper'] ?? [];
64 64
 
65 65
         // parse the function input to get the actual route and parameters we'll be working with
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
         // if the route is a closure, we'll just call it
74 74
         if ($route instanceof Closure) {
75
-            $wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($route) {
75
+            $wrapper['href'] = function($crud, $column, $entry, $related_key) use ($route) {
76 76
                 return $route($entry, $related_key, $column, $crud);
77 77
             };
78 78
             $this->wrapper($wrapper);
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
         }
82 82
 
83 83
         // if the route doesn't exist, we'll throw an exception
84
-        if (! $routeInstance = Route::getRoutes()->getByName($route)) {
84
+        if (!$routeInstance = Route::getRoutes()->getByName($route)) {
85 85
             throw new Exception("Route [{$route}] not found while building the link for column [{$this->attributes['name']}].");
86 86
         }
87 87
 
88 88
         // calculate the parameters we'll be using for the route() call
89 89
         // (eg. if there's only one parameter and user didn't provide it, we'll assume it's the entry's related key)
90
-        $parameters = (function () use ($parameters, $routeInstance, $route) {
90
+        $parameters = (function() use ($parameters, $routeInstance, $route) {
91 91
             $expectedParameters = $routeInstance->parameterNames();
92 92
 
93 93
             if (count($expectedParameters) === 0) {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             if (count($autoInferredParameter) > 1) {
99 99
                 throw new Exception("Route [{$route}] expects parameters [".implode(', ', $expectedParameters)."]. Insufficient parameters provided in column: [{$this->attributes['name']}].");
100 100
             }
101
-            $autoInferredParameter = current($autoInferredParameter) ? [current($autoInferredParameter) => function ($entry, $related_key, $column, $crud) {
101
+            $autoInferredParameter = current($autoInferredParameter) ? [current($autoInferredParameter) => function($entry, $related_key, $column, $crud) {
102 102
                 $entity = $crud->isAttributeInRelationString($column) ? Str::before($column['entity'], '.') : $column['entity'];
103 103
 
104 104
                 return $related_key ?? $entry->{$entity}?->getKey();
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         })();
109 109
 
110 110
         // set up the wrapper href attribute
111
-        $wrapper['href'] = function ($crud, $column, $entry, $related_key) use ($route, $parameters) {
111
+        $wrapper['href'] = function($crud, $column, $entry, $related_key) use ($route, $parameters) {
112 112
             // if the parameter is callable, we'll call it
113 113
             $parameters = collect($parameters)->map(fn ($item) => is_callable($item) ? $item($entry, $related_key, $column, $crud) : $item)->toArray();
114 114
 
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
     });
126 126
 }
127 127
 
128
-if (! CrudColumn::hasMacro('linkToShow')) {
129
-    CrudColumn::macro('linkToShow', function (): static {
128
+if (!CrudColumn::hasMacro('linkToShow')) {
129
+    CrudColumn::macro('linkToShow', function(): static {
130 130
         $name = $this->attributes['name'];
131 131
         $entity = $this->attributes['entity'] ?? null;
132 132
         $route = "$entity.show";
133 133
 
134
-        if (! $entity) {
134
+        if (!$entity) {
135 135
             throw new Exception("Entity not found while building the link for column [{$name}].");
136 136
         }
137 137
 
138
-        if (! Route::getRoutes()->getByName($route)) {
138
+        if (!Route::getRoutes()->getByName($route)) {
139 139
             throw new Exception("Route '{$route}' not found while building the link for column [{$name}].");
140 140
         }
141 141
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
     });
147 147
 }
148 148
 
149
-if (! CrudColumn::hasMacro('linkTarget')) {
150
-    CrudColumn::macro('linkTarget', function (string $target = '_self'): static {
149
+if (!CrudColumn::hasMacro('linkTarget')) {
150
+    CrudColumn::macro('linkTarget', function(string $target = '_self'): static {
151 151
         $this->wrapper([
152 152
             ...$this->attributes['wrapper'] ?? [],
153 153
             'target' => $target,
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * It will go to the given CrudController and get the setupRoutes() method on it.
165 165
  */
166
-if (! Route::hasMacro('crud')) {
167
-    Route::macro('crud', function ($name, $controller) {
166
+if (!Route::hasMacro('crud')) {
167
+    Route::macro('crud', function($name, $controller) {
168 168
         // put together the route name prefix,
169 169
         // as passed to the Route::group() statements
170 170
         $routeName = '';
Please login to merge, or discard this patch.
src/app/Library/Uploaders/Support/Interfaces/UploaderInterface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * Static constructor function.
12 12
      */
13
-    public static function for(array $field, array $configuration): UploaderInterface;
13
+    public static function for (array $field, array $configuration): UploaderInterface;
14 14
 
15 15
     /**
16 16
      * Default implementation functions.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
     public function relationship(bool $isRelation): self;
36 36
 
37
-    public function fake(bool|string $isFake): self;
37
+    public function fake(bool | string $isFake): self;
38 38
 
39 39
     /**
40 40
      * Getters.
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function getExpirationTimeInMinutes(): int;
53 53
 
54
-    public function getFileName(string|UploadedFile $file): string;
54
+    public function getFileName(string | UploadedFile $file): string;
55 55
 
56 56
     public function getRepeatableContainerName(): ?string;
57 57
 
Please login to merge, or discard this patch.