Test Setup Failed
Push — master ( 41f7ac...21f1bb )
by Php Easy Api
04:02
created

Process   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A command() 0 11 2
1
<?php
2
3
namespace Resta\Support;
4
5
use Symfony\Component\Process\Process as ProcessHandler;
6
use Symfony\Component\Process\Exception\ProcessFailedException;
7
8
class Process
9
{
10
    /**
11
     * command process
12
     *
13
     * @param null|string $command
14
     */
15
    public function command($command=null)
16
    {
17
        $process = new ProcessHandler($command,root.'');
0 ignored issues
show
Bug introduced by
It seems like $command can also be of type string; however, parameter $command of Symfony\Component\Process\Process::__construct() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

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

17
        $process = new ProcessHandler(/** @scrutinizer ignore-type */ $command,root.'');
Loading history...
18
        $process->run();
19
20
        // executes after the command finishes
21
        if (!$process->isSuccessful()) {
22
            throw new ProcessFailedException($process);
23
        }
24
25
        echo $process->getOutput();
26
    }
27
}