Completed
Push — master ( cfc46b...5a6c91 )
by Thomas
09:47 queued 07:37
created

ExecutionProcessFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 36
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A create() 0 6 1
1
<?php
2
3
namespace Task\TaskBundle\Executor;
4
5
use Symfony\Component\Process\Process;
6
use Symfony\Component\Process\ProcessBuilder;
7
8
/**
9
 * Factory for execution-process.
10
 */
11
class ExecutionProcessFactory
12
{
13
    /**
14
     * @var string
15
     */
16
    private $consolePath;
17
18
    /**
19
     * @var string
20
     */
21
    private $environment;
22
23
    /**
24
     * @param string $consolePath
25
     * @param string $environment
26
     */
27 13
    public function __construct($consolePath, $environment)
28
    {
29 13
        $this->consolePath = $consolePath;
30 13
        $this->environment = $environment;
31 13
    }
32
33
    /**
34
     * Create process for given execution-uuid.
35
     *
36
     * @param string $uuid
37
     *
38
     * @return Process
39
     */
40 2
    public function create($uuid)
41
    {
42 2
        return $process = ProcessBuilder::create(
0 ignored issues
show
Unused Code introduced by
$process is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
43 2
            [$this->consolePath, 'task:execute', $uuid, '-e ' . $this->environment]
44 2
        )->getProcess();
45
    }
46
}
47