Introduce FrontController as the replacement for RootController.
[hoplite.git] / http / interceptor.php
1 <?php
2 // Hoplite
3 // Copyright (c) 2015 Blue Static
4 //
5 // This program is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation, either version 3 of the License, or any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 // more details.
13 //
14 // You should have received a copy of the GNU General Public License along with
15 // this program. If not, see <http://www.gnu.org/licenses/>.
16
17 namespace hoplite\http;
18
19 /*!
20 An Interceptor runs as part of FrontController::RouteRequest() to provide
21 extra processing before the Action is Invoke()ed. The Action is provided to
22 allow the Interceptor to change the control flow based on characteristics
23 of the Action processor. An Interceptor may interrupt the control flow by
24 calling SendResponse() on the controller.
25 */
26 interface Interceptor
27 {
28 /*!
29 Performs the action and fills out the response's data model.
30 */
31 public function DoIntercept(FrontController $controller,
32 Action $action = NULL,
33 Request $request,
34 Response $response);
35 }