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 | * Configure a protocol based port for 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 port( |
||
239 | |||
240 | /** |
||
241 | * Add a secondary domain to a virtual host |
||
242 | * |
||
243 | * @param string $account Account name |
||
244 | * @param DomainInterface $domain Domain |
||
245 | * @param string $docroot Document root |
||
246 | * @return VhostInterface Virtual host |
||
247 | */ |
||
248 | public function addDomain(AccountInterface $account, DomainInterface $domain, $docroot = '') |
||
258 | |||
259 | /** |
||
260 | * Remove a secondary domain from a virtual host |
||
261 | * |
||
262 | * @param string $account Account name |
||
263 | * @param DomainInterface $domain Domain |
||
264 | * @param string $docroot Document root |
||
265 | * @return VhostInterface Virtual host |
||
266 | */ |
||
267 | public function removeDomain(AccountInterface $account, DomainInterface $domain, $docroot = '') |
||
277 | |||
278 | /** |
||
279 | * Validate a given document root path |
||
280 | * |
||
281 | * @param AccountInterface $account Account |
||
282 | * @param string $docroot Document root |
||
283 | * @return string Validated document root |
||
284 | */ |
||
285 | protected function validateDocroot(AccountInterface $account, $docroot) |
||
290 | } |
||
291 |