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 — fix-save-actions-when-all-acti... ( 479c6c )
by Pedro
14:31
created
src/app/Library/CrudPanel/Traits/SaveActions.php 1 patch
Spacing   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $higherAction = $this->getSaveActionByOrder(1);
29 29
 
30 30
         //if there is an higher action and that action is not the backpack default higher one `save_and_back` we return it.
31
-        if (! empty($higherAction) && key($higherAction) !== 'save_and_back') {
31
+        if (!empty($higherAction) && key($higherAction) !== 'save_and_back') {
32 32
             return key($higherAction);
33 33
         }
34 34
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function getSaveActionByOrder($order)
49 49
     {
50
-        return array_filter($this->getOperationSetting('save_actions') ?? [], function ($arr) use ($order) {
50
+        return array_filter($this->getOperationSetting('save_actions') ?? [], function($arr) use ($order) {
51 51
             return $arr['order'] == $order;
52 52
         });
53 53
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
         $actions = $this->getOperationSetting('save_actions') ?? [];
90 90
 
91
-        if (! in_array($saveAction['name'], $actions)) {
91
+        if (!in_array($saveAction['name'], $actions)) {
92 92
             $actions[$saveAction['name']] = $saveAction;
93 93
         }
94 94
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     public function orderSaveAction(string $saveAction, int $wantedOrder)
106 106
     {
107 107
         $actions = $this->getOperationSetting('save_actions') ?? [];
108
-        if (! empty($actions)) {
108
+        if (!empty($actions)) {
109 109
             $replaceOrder = isset($actions[$saveAction]) ? $actions[$saveAction]['order'] : count($actions) + 1;
110 110
 
111 111
             foreach ($actions as $key => $sv) {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     public function orderSaveActions(array $saveActions)
200 200
     {
201 201
         foreach ($saveActions as $sv => $order) {
202
-            if (! is_int($order)) {
202
+            if (!is_int($order)) {
203 203
                 $this->orderSaveAction($order, $sv + 1);
204 204
             } else {
205 205
                 $this->orderSaveAction($sv, $order);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     {
217 217
         $actions = $this->getOperationSetting('save_actions') ?? [];
218 218
 
219
-        uasort($actions, function ($a, $b) {
219
+        uasort($actions, function($a, $b) {
220 220
             return $a['order'] <=> $b['order'];
221 221
         });
222 222
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             }
239 239
         }
240 240
 
241
-        return array_filter($actions, function ($action) {
241
+        return array_filter($actions, function($action) {
242 242
             return $action['visible'] == true;
243 243
         }, ARRAY_FILTER_USE_BOTH);
244 244
     }
@@ -304,8 +304,7 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public function setSaveAction($forceSaveAction = null)
306 306
     {
307
-        $saveAction = $forceSaveAction ?:
308
-            $this->getRequest()->input('_save_action', $this->getFallBackSaveAction());
307
+        $saveAction = $forceSaveAction ?: $this->getRequest()->input('_save_action', $this->getFallBackSaveAction());
309 308
 
310 309
         $showBubble = $this->getOperationSetting('showSaveActionChange') ?? config('backpack.crud.operations.'.$this->getCurrentOperation().'.showSaveActionChange') ?? true;
311 310
 
@@ -373,20 +372,20 @@  discard block
 block discarded – undo
373 372
         $defaultSaveActions = [
374 373
             [
375 374
                 'name'    => 'save_and_back',
376
-                'visible' => function ($crud) {
375
+                'visible' => function($crud) {
377 376
                     return $crud->hasAccess('list');
378 377
                 },
379
-                'redirect' => function ($crud, $request, $itemId = null) {
378
+                'redirect' => function($crud, $request, $itemId = null) {
380 379
                     return $request->has('_http_referrer') ? $request->get('_http_referrer') : $crud->route;
381 380
                 },
382 381
                 'button_text' => trans('backpack::crud.save_action_save_and_back'),
383 382
             ],
384 383
             [
385 384
                 'name'    => 'save_and_edit',
386
-                'visible' => function ($crud) {
385
+                'visible' => function($crud) {
387 386
                     return $crud->hasAccess('update');
388 387
                 },
389
-                'redirect' => function ($crud, $request, $itemId = null) {
388
+                'redirect' => function($crud, $request, $itemId = null) {
390 389
                     $itemId = $itemId ?: $request->get('id');
391 390
                     $redirectUrl = $crud->route.'/'.$itemId.'/edit';
392 391
                     if ($request->has('_locale')) {
@@ -398,17 +397,17 @@  discard block
 block discarded – undo
398 397
 
399 398
                     return $redirectUrl;
400 399
                 },
401
-                'referrer_url' => function ($crud, $request, $itemId) {
400
+                'referrer_url' => function($crud, $request, $itemId) {
402 401
                     return url($crud->route.'/'.$itemId.'/edit');
403 402
                 },
404 403
                 'button_text' => trans('backpack::crud.save_action_save_and_edit'),
405 404
             ],
406 405
             [
407 406
                 'name'    => 'save_and_new',
408
-                'visible' => function ($crud) {
407
+                'visible' => function($crud) {
409 408
                     return $crud->hasAccess('create');
410 409
                 },
411
-                'redirect' => function ($crud, $request, $itemId = null) {
410
+                'redirect' => function($crud, $request, $itemId = null) {
412 411
                     return $this->route.'/create';
413 412
                 },
414 413
                 'button_text' => trans('backpack::crud.save_action_save_and_new'),
Please login to merge, or discard this patch.