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

DetectDeprecatedWysiwygUsageStep::run()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 19
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 11
c 1
b 0
f 1
nc 3
nop 0
dl 0
loc 19
rs 9.9
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 DetectDeprecatedWysiwygUsageStep extends Step
9
{
10
    public function title(): string
11
    {
12
        return 'Detect deprecated wysiwyg field/column aliases';
13
    }
14
15
    public function run(): StepResult
16
    {
17
        $matches = $this->context()->searchTokens(['wysiwyg']);
18
        $paths = $matches['wysiwyg'] ?? [];
19
20
        if (empty($paths)) {
21
            return StepResult::success('No wysiwyg aliases detected.');
22
        }
23
24
        $preview = array_slice($paths, 0, 10);
25
        $details = array_map(fn ($path) => "- {$path}", $preview);
26
27
        if (count($paths) > count($preview)) {
28
            $details[] = sprintf('… %d more occurrence(s) omitted.', count($paths) - count($preview));
29
        }
30
31
        return StepResult::warning(
32
            'Replace the wysiwyg field/column with ckeditor or text (the alias was removed).',
33
            $details
34
        );
35
    }
36
}
37