TaskCompleted::getOutput()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace Bencagri\Artisan\Deployer\Task;
5
6
use Bencagri\Artisan\Deployer\Server\Server;
7
8
/**
9
 * It is an immutable object that encapsulates the result of executing a task
10
 * and provides helper methods to get all its information.
11
 */
12
class TaskCompleted
13
{
14
    private $server;
15
    private $output;
16
    private $exitCode;
17
18
    public function __construct(Server $server, string $output, int $exitCode)
19
    {
20
        $this->server = $server;
21
        $this->output = $output;
22
        $this->exitCode = $exitCode;
23
    }
24
25
    public function isSuccessful() : bool
26
    {
27
        return 0 === $this->exitCode;
28
    }
29
30
    public function getServer() : Server
31
    {
32
        return $this->server;
33
    }
34
35
    public function getOutput() : string
36
    {
37
        return $this->output;
38
    }
39
40
    public function getTrimmedOutput() : string
41
    {
42
        return trim($this->output);
43
    }
44
45
    public function getExitCode() : int
46
    {
47
        return $this->exitCode;
48
    }
49
}
50