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 — add-update-command ( 52996a...7d33d9 )
by Pedro
14:43
created

CheckListOperationViewPublishedStep::fixMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Backpack\CRUD\app\Console\Commands\Upgrade\v7\Steps;
4
5
use Backpack\CRUD\app\Console\Commands\Upgrade\Step;
6
use Backpack\CRUD\app\Console\Commands\Upgrade\StepResult;
7
use Backpack\CRUD\app\Console\Commands\Upgrade\StepStatus;
8
9
class CheckListOperationViewPublishedStep extends Step
10
{
11
    protected string $relativePath = 'resources/views/vendor/backpack/crud/list.blade.php';
12
13
    public function title(): string
14
    {
15
        return 'Published list operation view';
16
    }
17
18
    public function run(): StepResult
19
    {
20
        if (! $this->context()->fileExists($this->relativePath)) {
21
            return StepResult::success('List operation view is not published, package default will be used.');
22
        }
23
24
        return StepResult::warning(
25
            'A published list.blade.php was found. The bundled view received significant updates; delete the published copy to use the latest Backpack version.',
26
            ["Published view: {$this->relativePath}"]
27
        );
28
    }
29
30
    public function canFix(StepResult $result): bool
31
    {
32
        return $result->status === StepStatus::Warning && $this->context()->fileExists($this->relativePath);
33
    }
34
35
    public function fixMessage(StepResult $result): string
36
    {
37
        return 'We can delete the published list.blade.php so Backpack uses the updated bundled view. Proceed?';
38
    }
39
40
    public function fix(StepResult $result): StepResult
41
    {
42
        if (! $this->context()->fileExists($this->relativePath)) {
43
            return StepResult::skipped('Published list.blade.php was already removed.');
44
        }
45
46
        if (! $this->context()->deleteFile($this->relativePath)) {
47
            return StepResult::failure("Could not delete {$this->relativePath} automatically.");
48
        }
49
50
        return StepResult::success('Removed the published list.blade.php so the package view is used.');
51
    }
52
}
53