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 ( 3eac9b )
by Pedro
15:29
created

CheckShowOperationComponentStep::run()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 20
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 4
eloc 10
c 1
b 0
f 1
nc 4
nop 0
dl 0
loc 20
rs 9.9332
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
8
class CheckShowOperationComponentStep extends Step
9
{
10
    protected string $relativePath = 'config/backpack/operations/show.php';
11
12
    public function title(): string
13
    {
14
        return 'Show operation component configuration';
15
    }
16
17
    public function run(): StepResult
18
    {
19
        $contents = $this->context()->readFile($this->relativePath);
20
21
        if ($contents === null) {
22
            return StepResult::skipped('show.php is not published, core defaults already use the new datagrid component.');
23
        }
24
25
        if (! str_contains($contents, "'component'")) {
26
            return StepResult::warning(
27
                "Add the 'component' option to config/backpack/operations/show.php to pick between bp-datagrid and bp-datalist.",
28
                ['Example:    "component" => "bp-datagrid"']
29
            );
30
        }
31
32
        if (str_contains($contents, "'bp-datalist'")) {
33
            return StepResult::success('Show operation will keep the classic bp-datalist component.');
34
        }
35
36
        return StepResult::success('Show operation is configured to use the new component.');
37
    }
38
}
39