TaskCompleted   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getExitCode() 0 3 1
A getOutput() 0 3 1
A getTrimmedOutput() 0 3 1
A __construct() 0 5 1
A isSuccessful() 0 3 1
A getServer() 0 3 1
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