1 | <?php |
||
15 | class Host |
||
16 | { |
||
17 | use ConfigurationAccessor; |
||
18 | |||
19 | private $hostname; |
||
20 | private $realHostname; |
||
21 | private $user; |
||
22 | private $port; |
||
23 | private $configFile; |
||
24 | private $identityFile; |
||
25 | private $forwardAgent = true; |
||
26 | private $multiplexing = null; |
||
27 | private $sshArguments; |
||
28 | private $shellCommand = 'bash -s'; |
||
29 | |||
30 | /** |
||
31 | * @param string $hostname |
||
32 | */ |
||
33 | 34 | public function __construct(string $hostname) |
|
40 | |||
41 | 3 | private function initOptions() |
|
59 | |||
60 | /** |
||
61 | * Returns pair user/hostname |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | 6 | public function __toString() |
|
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | 28 | public function getHostname() |
|
78 | |||
79 | /** |
||
80 | * @return mixed |
||
81 | */ |
||
82 | public function getRealHostname() |
||
86 | |||
87 | 4 | public function hostname(string $hostname): self |
|
92 | |||
93 | /** |
||
94 | * @param mixed $hostname |
||
95 | */ |
||
96 | 34 | private function setRealHostname(string $hostname) |
|
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | 2 | public function getUser() |
|
108 | |||
109 | 4 | public function user(string $user): self |
|
114 | |||
115 | /** |
||
116 | * @return int |
||
117 | */ |
||
118 | 4 | public function getPort() |
|
122 | |||
123 | 4 | public function port(int $port): self |
|
128 | |||
129 | /** |
||
130 | * @return string |
||
131 | */ |
||
132 | 2 | public function getConfigFile() |
|
136 | |||
137 | 3 | public function configFile(string $configFile): self |
|
142 | |||
143 | /** |
||
144 | * @return string |
||
145 | */ |
||
146 | 3 | public function getIdentityFile() |
|
150 | |||
151 | 4 | public function identityFile(string $identityFile): self |
|
156 | |||
157 | /** |
||
158 | * @return bool |
||
159 | */ |
||
160 | 2 | public function isForwardAgent() |
|
164 | |||
165 | 3 | public function forwardAgent(bool $forwardAgent = true): self |
|
170 | |||
171 | /** |
||
172 | * @return bool |
||
173 | */ |
||
174 | 2 | public function isMultiplexing() |
|
178 | |||
179 | 3 | public function multiplexing(bool $multiplexing = true): self |
|
184 | |||
185 | 3 | public function getSshArguments() |
|
190 | |||
191 | 3 | public function sshOptions(array $options): self |
|
196 | |||
197 | 2 | public function sshFlags(array $flags): self |
|
202 | |||
203 | 1 | public function addSshOption(string $option, $value): self |
|
208 | |||
209 | public function addSshFlag(string $flag, string $value = null): self |
||
214 | |||
215 | public function getShellCommand() : string |
||
219 | |||
220 | public function shellCommand(string $shellCommand): self |
||
225 | |||
226 | 5 | public function stage(string $stage): self |
|
231 | |||
232 | 5 | public function binary(string $binary, string $path) |
|
240 | 5 | ||
241 | public function getBinary(string $binary): ?string |
||
247 | |||
248 | public function roles(...$roles): self |
||
258 | |||
259 | public function become(string $user): self |
||
264 | } |
||
265 |