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 ( 13a497...cc92a3 )
by Pedro
11:24
created

Step::isBlocking()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
cc 1
rs 10
1
<?php
2
3
namespace Backpack\CRUD\app\Console\Commands\Upgrade;
4
5
use Backpack\CRUD\app\Console\Commands\Upgrade\Concerns\ExtractsFirstInteger;
6
7
abstract class Step
8
{
9
    use ExtractsFirstInteger;
10
11
    public function __construct(protected UpgradeContext $context)
12
    {
13
    }
14
15
    abstract public function title(): string;
16
17
    public function description(): ?string
18
    {
19
        return null;
20
    }
21
22
    abstract public function run(): StepResult;
23
24
    protected function context(): UpgradeContext
25
    {
26
        return $this->context;
27
    }
28
29
    public function canFix(StepResult $result): bool
0 ignored issues
show
Unused Code introduced by
The parameter $result is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    public function canFix(/** @scrutinizer ignore-unused */ StepResult $result): bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
        return false;
32
    }
33
34
    public function fixMessage(StepResult $result): string
0 ignored issues
show
Unused Code introduced by
The parameter $result is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public function fixMessage(/** @scrutinizer ignore-unused */ StepResult $result): string

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36
        return 'Apply automatic fix?';
37
    }
38
39
    public function fix(StepResult $result): StepResult
0 ignored issues
show
Unused Code introduced by
The parameter $result is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

39
    public function fix(/** @scrutinizer ignore-unused */ StepResult $result): StepResult

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
        return StepResult::skipped('No automatic fix available.');
42
    }
43
44
    public function isBlocking(): bool
45
    {
46
        return false;
47
    }
48
49
    /**
50
     * Build a preview of items with an optional formatter and overflow message.
51
     *
52
     * @param  array<int, mixed>  $items
53
     * @param  callable|null  $formatter
54
     * @return array<int, string>
55
     */
56
    protected function previewList(
57
        array $items,
58
        int $limit = 10,
59
        ?callable $formatter = null,
60
        ?string $overflowMessage = null
61
    ): array {
62
        if (empty($items)) {
63
            return [];
64
        }
65
66
        $formatter ??= static fn ($item): string => '- '.(string) $item;
67
        $preview = array_slice($items, 0, $limit);
68
        $details = array_map($formatter, $preview);
69
70
        $remaining = count($items) - count($preview);
71
72
        if ($remaining > 0) {
73
            $details[] = sprintf($overflowMessage ?? '... %d more item(s) omitted.', $remaining);
74
        }
75
76
        return $details;
77
    }
78
}
79