Completed
Push — master ( 400051...4d5855 )
by Alessandro
07:06
created

SymfonyProcessWrapper   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 9
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 85
ccs 19
cts 19
cp 1
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A isTerminated() 0 4 1
A start() 0 4 1
A getOutput() 0 4 1
A getExitCode() 0 4 1
A reset() 0 9 1
A getCommandLine() 0 4 1
A __construct() 0 5 1
A restart() 0 6 1
A isRunning() 0 4 1
1
<?php
2
3
namespace Paraunit\Process;
4
5
use Symfony\Component\Process\Process;
6
7
/**
8
 * Class SymfonyProcessWrapper
9
 * @package Paraunit\Process
10
 */
11
class SymfonyProcessWrapper extends AbstractParaunitProcess
12
{
13
    /** @var Process */
14
    protected $process;
15
16
    /**
17
     * {@inheritdoc}
18
     */
19 15
    public function __construct($commandLine, $uniqueId)
20
    {
21 15
        parent::__construct($commandLine, $uniqueId);
22 15
        $this->process = new Process($commandLine);
23 15
    }
24
25
    /**
26
     * @return bool
27
     */
28 11
    public function isTerminated()
29
    {
30 11
        return $this->process->isTerminated();
31
    }
32
33
    /**
34
     *
35
     */
36 11
    public function start()
37
    {
38 11
        $this->process->start();
39 11
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 3
    public function getOutput()
45
    {
46 3
        return $this->process->getOutput();
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 11
    public function getExitCode()
53
    {
54 11
        return $this->process->getExitCode();
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function restart()
61
    {
62
        $this->reset()->start();
63
64
        return $this;
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70 3
    public function reset()
71
    {
72
        // RESET DELLO STATO
73 3
        parent::reset();
74
75 3
        $this->process = new Process($this->process->getCommandLine());
76
77 3
        return $this;
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     */
83 1
    public function getCommandLine()
84
    {
85 1
        return $this->process->getCommandLine();
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91
    public function isRunning()
92
    {
93
        return $this->process->isRunning();
94
    }
95
}
96