Total Complexity | 9 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class Task |
||
9 | { |
||
10 | /** @var Server[] $servers */ |
||
11 | private $servers; |
||
12 | private $shellCommand; |
||
13 | private $envVars; |
||
14 | |||
15 | public function __construct(array $servers, string $shellCommand, array $envVars = []) |
||
16 | { |
||
17 | if (empty($servers)) { |
||
18 | throw new \InvalidArgumentException('The "servers" argument of a Task cannot be an empty array. Add at least one server.'); |
||
19 | } |
||
20 | |||
21 | $this->servers = $servers; |
||
22 | $this->shellCommand = $shellCommand; |
||
23 | $this->envVars = $envVars; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @return Server[] |
||
28 | */ |
||
29 | public function getServers() : array |
||
30 | { |
||
31 | return $this->servers; |
||
32 | } |
||
33 | |||
34 | public function isLocal() : bool |
||
35 | { |
||
36 | foreach ($this->servers as $server) { |
||
37 | if (!$server->isLocalHost()) { |
||
38 | return false; |
||
39 | } |
||
40 | } |
||
41 | |||
42 | return true; |
||
43 | } |
||
44 | |||
45 | public function isRemote() : bool |
||
48 | } |
||
49 | |||
50 | public function getShellCommand() : string |
||
51 | { |
||
52 | return $this->shellCommand; |
||
53 | } |
||
54 | |||
55 | public function getEnvVars() : array |
||
58 | } |
||
59 | } |
||
60 |