1 | <?php |
||
15 | class Host |
||
16 | { |
||
17 | use ConfigurationAccessor; |
||
18 | |||
19 | private $hostname; |
||
20 | private $user; |
||
21 | private $port; |
||
22 | private $configFile; |
||
23 | private $identityFile; |
||
24 | private $forwardAgent = true; |
||
25 | private $multiplexing = null; |
||
26 | private $sshArguments; |
||
27 | |||
28 | /** |
||
29 | * @param string $hostname |
||
30 | */ |
||
31 | 19 | public function __construct(string $hostname) |
|
37 | |||
38 | 3 | private function initOptions() |
|
56 | |||
57 | /** |
||
58 | * Returns pair user/hostname |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 5 | public function __toString() |
|
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | */ |
||
72 | 14 | public function getHostname() |
|
76 | |||
77 | /** |
||
78 | * @param string $hostname |
||
79 | * @return $this |
||
80 | */ |
||
81 | 4 | public function hostname(string $hostname) |
|
86 | |||
87 | /** |
||
88 | * @return string |
||
89 | */ |
||
90 | 2 | public function getUser() |
|
94 | |||
95 | /** |
||
96 | * @param string $user |
||
97 | * @return $this |
||
98 | */ |
||
99 | 4 | public function user(string $user) |
|
104 | |||
105 | /** |
||
106 | * @return int |
||
107 | */ |
||
108 | 4 | public function getPort() |
|
112 | |||
113 | /** |
||
114 | * @param int $port |
||
115 | * @return $this |
||
116 | */ |
||
117 | 4 | public function port(int $port) |
|
122 | |||
123 | /** |
||
124 | * @return string |
||
125 | */ |
||
126 | 2 | public function getConfigFile() |
|
130 | |||
131 | /** |
||
132 | * @param string $configFile |
||
133 | * @return $this |
||
134 | */ |
||
135 | 3 | public function configFile(string $configFile) |
|
140 | |||
141 | /** |
||
142 | * @return string |
||
143 | */ |
||
144 | 2 | public function getIdentityFile() |
|
148 | |||
149 | /** |
||
150 | * @param string $identityFile |
||
151 | * @return $this |
||
152 | */ |
||
153 | 3 | public function identityFile(string $identityFile) |
|
158 | |||
159 | /** |
||
160 | * @return bool |
||
161 | */ |
||
162 | 2 | public function isForwardAgent() |
|
166 | |||
167 | /** |
||
168 | * @param bool $forwardAgent |
||
169 | * @return $this |
||
170 | */ |
||
171 | 3 | public function forwardAgent(bool $forwardAgent = true) |
|
176 | |||
177 | /** |
||
178 | * @return bool |
||
179 | */ |
||
180 | 2 | public function isMultiplexing() |
|
184 | |||
185 | /** |
||
186 | * @param bool $multiplexing |
||
187 | * @return $this |
||
188 | */ |
||
189 | 3 | public function multiplexing(bool $multiplexing = true) |
|
194 | |||
195 | 3 | public function getSshArguments() : Arguments |
|
200 | |||
201 | 3 | public function sshOptions(array $options) : Host |
|
206 | |||
207 | 2 | public function sshFlags(array $flags) : Host |
|
212 | |||
213 | 1 | public function addSshOption(string $option, $value) : Host |
|
218 | |||
219 | public function addSshFlag(string $flag, string $value = null) : Host |
||
224 | |||
225 | /** |
||
226 | * Set stage |
||
227 | * |
||
228 | * @param string $stage |
||
229 | * @return $this |
||
230 | */ |
||
231 | 2 | public function stage(string $stage) |
|
236 | |||
237 | /** |
||
238 | * Set roles |
||
239 | * |
||
240 | * @param array ...$roles |
||
241 | * @return $this |
||
242 | */ |
||
243 | 2 | public function roles(...$roles) |
|
253 | |||
254 | /** |
||
255 | * Set become |
||
256 | * |
||
257 | * @param string $user |
||
258 | * @return $this |
||
259 | */ |
||
260 | public function become(string $user) |
||
265 | } |
||
266 |