Completed
Push — master ( 1ece6c...656998 )
by Jan Philipp
13s queued 11s
created

DeferredProcess::log()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Psh\ScriptRuntime\Execution;
4
5
use Shopware\Psh\ScriptRuntime\DeferredProcessCommand;
6
use Symfony\Component\Process\Process;
7
8
class DeferredProcess
9
{
10
    /**
11
     * @var string
12
     */
13
    private $parsedCommand;
14
15
    /**
16
     * @var DeferredProcessCommand
17
     */
18
    private $command;
19
20
    /**
21
     * @var Process
22
     */
23
    private $process;
24
25
    /**
26
     * @var LogMessage[]
27
     */
28
    private $log = [];
29
30
    /**
31
     * @param string $parsedCommand
32
     * @param DeferredProcessCommand $command
33
     * @param Process $process
34
     */
35
    public function __construct(string $parsedCommand, DeferredProcessCommand $command, Process $process)
36
    {
37
        $this->command = $command;
38
        $this->process = $process;
39
        $this->parsedCommand = $parsedCommand;
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function getParsedCommand(): string
46
    {
47
        return $this->parsedCommand;
48
    }
49
50
    /**
51
     * @return DeferredProcessCommand
52
     */
53
    public function getCommand(): DeferredProcessCommand
54
    {
55
        return $this->command;
56
    }
57
58
    /**
59
     * @return Process
60
     */
61
    public function getProcess(): Process
62
    {
63
        return $this->process;
64
    }
65
66
    /**
67
     * @param LogMessage $logMessage
68
     */
69
    public function log(LogMessage $logMessage)
70
    {
71
        $this->log[] = $logMessage;
72
    }
73
74
    /**
75
     * @return LogMessage[]
76
     */
77
    public function getLog(): array
78
    {
79
        return $this->log;
80
    }
81
}
82