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( |
||
75 | |||
76 | /** |
||
77 | * Delete a virtual host |
||
78 | * |
||
79 | * @param AccountInterface $account Account |
||
80 | * @param string $docroot Document root |
||
81 | * @return VhostInterface Virtual host |
||
82 | */ |
||
83 | public function delete(AccountInterface $account, $docroot = '') |
||
87 | |||
88 | /** |
||
89 | * Enable a virtual host |
||
90 | * |
||
91 | * @param AccountInterface $account Account |
||
92 | * @param string $docroot Document root |
||
93 | * @return VhostInterface Virtual host |
||
94 | */ |
||
95 | public function enable(AccountInterface $account, $docroot = '') |
||
99 | |||
100 | /** |
||
101 | * Disable a virtual host |
||
102 | * |
||
103 | * @param AccountInterface $account Account |
||
104 | * @param string $docroot Document root |
||
105 | * @return VhostInterface Virtual host |
||
106 | */ |
||
107 | public function disable(AccountInterface $account, $docroot = '') |
||
111 | |||
112 | /** |
||
113 | * Redirect a virtual host |
||
114 | * |
||
115 | * @param string $account Account name |
||
116 | * @param string $docroot Document root |
||
117 | * @param string $url Redirect URL |
||
118 | * @param int $status Redirect HTTP status |
||
119 | * @return VhostInterface Virtual host |
||
120 | * @throws \RuntimeException If the redirect URL is invalid |
||
121 | * @throws \RuntimeException If the redirect HTTP status code is invalid |
||
122 | */ |
||
123 | public function redirect( |
||
151 | |||
152 | /** |
||
153 | * Configure the PHP version of a virtual host |
||
154 | * |
||
155 | * @param string $account Account name |
||
156 | * @param string $docroot Document root |
||
157 | * @param string|null $php PHP version |
||
158 | * @return VhostInterface Virtual host |
||
159 | * @throws \RuntimeException If the redirect URL is invalid |
||
160 | * @throws \RuntimeException If the redirect HTTP status code is invalid |
||
161 | */ |
||
162 | public function php(AccountInterface $account, $docroot = '', $php = null) |
||
173 | |||
174 | /** |
||
175 | * Configure a protocol based port for a virtual host |
||
176 | * |
||
177 | * @param AccountInterface $account Account |
||
178 | * @param string $docroot Document root |
||
179 | * @param int $protocol Protocol |
||
180 | * @param int|null $port Port |
||
181 | * @return VhostInterface Virtual host |
||
182 | * @throws \RuntimeException If the protocol is invalid |
||
183 | * @throws \RuntimeException If the protocol port is invalid |
||
184 | */ |
||
185 | public function port( |
||
209 | |||
210 | /** |
||
211 | * Add a secondary domain to a virtual host |
||
212 | * |
||
213 | * @param string $account Account name |
||
214 | * @param DomainInterface $domain Domain |
||
215 | * @param string $docroot Document root |
||
216 | * @return VhostInterface Virtual host |
||
217 | */ |
||
218 | public function addDomain(AccountInterface $account, DomainInterface $domain, $docroot = '') |
||
226 | |||
227 | /** |
||
228 | * Remove a secondary domain from a virtual host |
||
229 | * |
||
230 | * @param string $account Account name |
||
231 | * @param DomainInterface $domain Domain |
||
232 | * @param string $docroot Document root |
||
233 | * @return VhostInterface Virtual host |
||
234 | */ |
||
235 | public function removeDomain(AccountInterface $account, DomainInterface $domain, $docroot = '') |
||
243 | |||
244 | /** |
||
245 | * Validate a given document root path |
||
246 | * |
||
247 | * @param AccountInterface $account Account |
||
248 | * @param string $docroot Document root |
||
249 | * @return string Validated document root |
||
250 | */ |
||
251 | protected function validateDocroot(AccountInterface $account, $docroot) |
||
256 | } |
||
257 |