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 — update-command ( bea4c0...b6f0ed )
by Cristian
29:07
created

PublishAssets   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 46
rs 10
c 1
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A runConsoleCommand() 0 14 3
A handle() 0 3 1
1
<?php
2
3
namespace Backpack\CRUD\app\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use Symfony\Component\Process\Exception\ProcessFailedException;
7
use Symfony\Component\Process\Process;
8
9
class PublishAssets extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'backpack:publish-assets';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Publish new CSS and JS assets (will override existing ones).';
24
25
    /**
26
     * Execute the console command.
27
     *
28
     * @return mixed
29
     */
30
    public function handle()
31
    {
32
        $this->runConsoleCommand(['php', 'artisan', 'vendor:publish', '--provider=Backpack\CRUD\BackpackServiceProvider', '--tag=public', '--force']);
0 ignored issues
show
Bug introduced by
array('php', 'artisan', ...tag=public', '--force') of type array<integer,string> is incompatible with the type string expected by parameter $command of Backpack\CRUD\app\Consol...ts::runConsoleCommand(). ( Ignorable by Annotation )

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

32
        $this->runConsoleCommand(/** @scrutinizer ignore-type */ ['php', 'artisan', 'vendor:publish', '--provider=Backpack\CRUD\BackpackServiceProvider', '--tag=public', '--force']);
Loading history...
33
    }
34
35
    /**
36
     * Run a shell command in a separate process.
37
     *
38
     * @param  string  $command  Text to be executed.
39
     * @return void
40
     */
41
    private function runConsoleCommand($command)
42
    {
43
        $process = new Process($command, null, null, null, 60, null);
0 ignored issues
show
Bug introduced by
$command of type string is incompatible with the type array expected by parameter $command of Symfony\Component\Process\Process::__construct(). ( Ignorable by Annotation )

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

43
        $process = new Process(/** @scrutinizer ignore-type */ $command, null, null, null, 60, null);
Loading history...
Unused Code introduced by
The call to Symfony\Component\Process\Process::__construct() has too many arguments starting with null. ( Ignorable by Annotation )

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

43
        $process = /** @scrutinizer ignore-call */ new Process($command, null, null, null, 60, null);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
44
        $process->run(function ($type, $buffer) {
45
            if (Process::ERR === $type) {
46
                $this->line($buffer);
47
            } else {
48
                $this->line($buffer);
49
            }
50
        });
51
52
        // executes after the command finishes
53
        if (! $process->isSuccessful()) {
54
            throw new ProcessFailedException($process);
55
        }
56
    }
57
}
58