Completed
Branch output_parsers_refactor (d2cb12)
by Alessandro
02:20
created

StubbedParaProcess   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 8
Bugs 1 Features 1
Metric Value
wmc 12
c 8
b 1
f 1
lcom 0
cbo 1
dl 0
loc 112
rs 10
1
<?php
2
3
namespace Paraunit\Tests\Stub;
4
5
use Paraunit\Process\ParaunitProcessAbstract;
6
7
/**
8
 * Class StubbedParaProcess
9
 * @package Paraunit\Tests\Stub
10
 */
11
class StubbedParaProcess extends ParaunitProcessAbstract
12
{
13
    /**
14
     * @var string
15
     */
16
    protected $output;
17
18
    /**
19
     * @var string
20
     */
21
    protected $commandLine;
22
23
    /**
24
     * @var int
25
     */
26
    protected $exitCode = 0;
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function __construct($commandLine = 'testCommandLine', $uniqueId = null)
32
    {
33
        if (is_null($uniqueId)) {
34
            $uniqueId = md5($commandLine);
35
        }
36
37
        parent::__construct($commandLine, $uniqueId);
38
39
        $this->commandLine = $commandLine;
40
        $this->filename = 'Test.php';
41
    }
42
43
    /**
44
     * @param bool $isToBeRetried
45
     */
46
    public function setIsToBeRetried($isToBeRetried)
47
    {
48
        $this->shouldBeRetried = $isToBeRetried;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getCommandLine()
55
    {
56
        return $this->commandLine;
57
    }
58
59
    /**
60
     * @param string $output
61
     */
62
    public function setOutput($output)
63
    {
64
        $this->output = $output;
65
    }
66
67
    /**
68
     * @param int $exitCode
69
     */
70
    public function setExitCode($exitCode)
71
    {
72
        $this->exitCode = $exitCode;
73
    }
74
75
    /**
76
     * @return string
77
     */
78
    public function getOutput()
79
    {
80
        return $this->output;
81
    }
82
83
    /**
84
     * @return bool
85
     */
86
    public function isTerminated()
87
    {
88
        return true;
89
    }
90
91
    /**
92
     * @return mixed
93
     */
94
    public function start()
95
    {
96
        return;
97
    }
98
99
    /**
100
     * @return $this
101
     */
102
    public function restart()
103
    {
104
        return;
105
    }
106
107
    /**
108
     * @return bool
109
     */
110
    public function isRunning()
111
    {
112
        return false;
113
    }
114
115
    /**
116
     * @return int
117
     */
118
    public function getExitCode()
119
    {
120
        return $this->exitCode;
121
    }
122
}
123