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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 29
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A title() 0 3 1
A run() 0 20 4
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