1 | <?php |
||
51 | class VirtualHostService extends AbstractService |
||
52 | { |
||
53 | /** |
||
54 | * Create a virtual host |
||
55 | * |
||
56 | * @param AccountInterface $account Account |
||
57 | * @param DomainInterface $domain Domain |
||
58 | * @param string $docroot Document root |
||
59 | * @param string $type Virtual host Type |
||
60 | * @return VhostInterface Virtual host |
||
61 | */ |
||
62 | public function create( |
||
77 | |||
78 | /** |
||
79 | * Load a virtual host |
||
80 | * |
||
81 | * @param AccountInterface $account Account |
||
82 | * @param string $docroot Document root |
||
83 | * @return VhostInterface Virtual host |
||
84 | */ |
||
85 | public function load(AccountInterface $account, $docroot = '') |
||
89 | |||
90 | /** |
||
91 | * Delete a virtual host |
||
92 | * |
||
93 | * @param AccountInterface $account Account |
||
94 | * @param string $docroot Document root |
||
95 | * @return VhostInterface Virtual host |
||
96 | */ |
||
97 | public function delete(AccountInterface $account, $docroot = '') |
||
103 | |||
104 | /** |
||
105 | * Enable a virtual host |
||
106 | * |
||
107 | * @param AccountInterface $account Account |
||
108 | * @param string $docroot Document root |
||
109 | * @return VhostInterface Virtual host |
||
110 | */ |
||
111 | public function enable(AccountInterface $account, $docroot = '') |
||
117 | |||
118 | /** |
||
119 | * Disable a virtual host |
||
120 | * |
||
121 | * @param AccountInterface $account Account |
||
122 | * @param string $docroot Document root |
||
123 | * @return VhostInterface Virtual host |
||
124 | */ |
||
125 | public function disable(AccountInterface $account, $docroot = '') |
||
131 | |||
132 | /** |
||
133 | * Redirect a virtual host |
||
134 | * |
||
135 | * @param string $account Account name |
||
136 | * @param string $docroot Document root |
||
137 | * @param string $url Redirect URL |
||
138 | * @param int $status Redirect HTTP status |
||
139 | * @return VhostInterface Virtual host |
||
140 | * @throws \RuntimeException If the redirect URL is invalid |
||
141 | * @throws \RuntimeException If the redirect HTTP status code is invalid |
||
142 | */ |
||
143 | public function redirect( |
||
173 | |||
174 | /** |
||
175 | * Configure the PHP version of a virtual host |
||
176 | * |
||
177 | * @param string $account Account name |
||
178 | * @param string $docroot Document root |
||
179 | * @param string|null $php PHP version |
||
180 | * @return VhostInterface Virtual host |
||
181 | * @throws \RuntimeException If the redirect URL is invalid |
||
182 | * @throws \RuntimeException If the redirect HTTP status code is invalid |
||
183 | */ |
||
184 | public function php(AccountInterface $account, $docroot = '', $php = null) |
||
201 | |||
202 | /** |
||
203 | * Add a protocol port to a virtual host |
||
204 | * |
||
205 | * @param AccountInterface $account Account |
||
206 | * @param string $docroot Document root |
||
207 | * @param int $protocol Protocol |
||
208 | * @param int|null $port Port |
||
209 | * @return VhostInterface Virtual host |
||
210 | * @throws \RuntimeException If the protocol is invalid |
||
211 | * @throws \RuntimeException If the protocol port is invalid |
||
212 | */ |
||
213 | public function addPort( |
||
239 | |||
240 | /** |
||
241 | * Remove a protocol port from a virtual host |
||
242 | * |
||
243 | * @param AccountInterface $account Account |
||
244 | * @param string $docroot Document root |
||
245 | * @param int $protocol Protocol |
||
246 | * @param int|null $port Port |
||
247 | * @return VhostInterface Virtual host |
||
248 | * @throws \RuntimeException If the protocol is invalid |
||
249 | * @throws \RuntimeException If the protocol port is invalid |
||
250 | */ |
||
251 | public function removePort( |
||
277 | |||
278 | /** |
||
279 | * Add a secondary domain to a virtual host |
||
280 | * |
||
281 | * @param string $account Account name |
||
282 | * @param DomainInterface $domain Domain |
||
283 | * @param string $docroot Document root |
||
284 | * @return VhostInterface Virtual host |
||
285 | */ |
||
286 | public function addDomain(AccountInterface $account, DomainInterface $domain, $docroot = '') |
||
296 | |||
297 | /** |
||
298 | * Remove a secondary domain from a virtual host |
||
299 | * |
||
300 | * @param string $account Account name |
||
301 | * @param DomainInterface $domain Domain |
||
302 | * @param string $docroot Document root |
||
303 | * @return VhostInterface Virtual host |
||
304 | */ |
||
305 | public function removeDomain(AccountInterface $account, DomainInterface $domain, $docroot = '') |
||
315 | |||
316 | /** |
||
317 | * Validate a given document root path |
||
318 | * |
||
319 | * @param AccountInterface $account Account |
||
320 | * @param string $docroot Document root |
||
321 | * @return string Validated document root |
||
322 | */ |
||
323 | protected function validateDocroot(AccountInterface $account, $docroot) |
||
328 | |||
329 | /** |
||
330 | * Certify a virtual host |
||
331 | * |
||
332 | * @param AccountInterface $account Account |
||
333 | * @param string $docroot Document root |
||
334 | * @return VhostInterface Virtual host |
||
335 | */ |
||
336 | public function certify(AccountInterface $account, $docroot = '') |
||
342 | } |
||
343 |