@@ -35,68 +35,68 @@ |
||
35 | 35 | * @since 6.0.0 |
36 | 36 | */ |
37 | 37 | abstract class Middleware { |
38 | - /** |
|
39 | - * This is being run in normal order before the controller is being |
|
40 | - * called which allows several modifications and checks |
|
41 | - * |
|
42 | - * @param Controller $controller the controller that is being called |
|
43 | - * @param string $methodName the name of the method that will be called on |
|
44 | - * the controller |
|
45 | - * @return void |
|
46 | - * @since 6.0.0 |
|
47 | - */ |
|
48 | - public function beforeController($controller, $methodName) { |
|
49 | - } |
|
38 | + /** |
|
39 | + * This is being run in normal order before the controller is being |
|
40 | + * called which allows several modifications and checks |
|
41 | + * |
|
42 | + * @param Controller $controller the controller that is being called |
|
43 | + * @param string $methodName the name of the method that will be called on |
|
44 | + * the controller |
|
45 | + * @return void |
|
46 | + * @since 6.0.0 |
|
47 | + */ |
|
48 | + public function beforeController($controller, $methodName) { |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * This is being run when either the beforeController method or the |
|
54 | - * controller method itself is throwing an exception. The middleware is |
|
55 | - * asked in reverse order to handle the exception and to return a response. |
|
56 | - * If the response is null, it is assumed that the exception could not be |
|
57 | - * handled and the error will be thrown again |
|
58 | - * |
|
59 | - * @param Controller $controller the controller that is being called |
|
60 | - * @param string $methodName the name of the method that will be called on |
|
61 | - * the controller |
|
62 | - * @param \Exception $exception the thrown exception |
|
63 | - * @throws \Exception the passed in exception if it can't handle it |
|
64 | - * @return Response a Response object in case that the exception was handled |
|
65 | - * @since 6.0.0 |
|
66 | - */ |
|
67 | - public function afterException($controller, $methodName, \Exception $exception) { |
|
68 | - throw $exception; |
|
69 | - } |
|
52 | + /** |
|
53 | + * This is being run when either the beforeController method or the |
|
54 | + * controller method itself is throwing an exception. The middleware is |
|
55 | + * asked in reverse order to handle the exception and to return a response. |
|
56 | + * If the response is null, it is assumed that the exception could not be |
|
57 | + * handled and the error will be thrown again |
|
58 | + * |
|
59 | + * @param Controller $controller the controller that is being called |
|
60 | + * @param string $methodName the name of the method that will be called on |
|
61 | + * the controller |
|
62 | + * @param \Exception $exception the thrown exception |
|
63 | + * @throws \Exception the passed in exception if it can't handle it |
|
64 | + * @return Response a Response object in case that the exception was handled |
|
65 | + * @since 6.0.0 |
|
66 | + */ |
|
67 | + public function afterException($controller, $methodName, \Exception $exception) { |
|
68 | + throw $exception; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * This is being run after a successful controllermethod call and allows |
|
74 | - * the manipulation of a Response object. The middleware is run in reverse order |
|
75 | - * |
|
76 | - * @param Controller $controller the controller that is being called |
|
77 | - * @param string $methodName the name of the method that will be called on |
|
78 | - * the controller |
|
79 | - * @param Response $response the generated response from the controller |
|
80 | - * @return Response a Response object |
|
81 | - * @since 6.0.0 |
|
82 | - */ |
|
83 | - public function afterController($controller, $methodName, Response $response) { |
|
84 | - return $response; |
|
85 | - } |
|
72 | + /** |
|
73 | + * This is being run after a successful controllermethod call and allows |
|
74 | + * the manipulation of a Response object. The middleware is run in reverse order |
|
75 | + * |
|
76 | + * @param Controller $controller the controller that is being called |
|
77 | + * @param string $methodName the name of the method that will be called on |
|
78 | + * the controller |
|
79 | + * @param Response $response the generated response from the controller |
|
80 | + * @return Response a Response object |
|
81 | + * @since 6.0.0 |
|
82 | + */ |
|
83 | + public function afterController($controller, $methodName, Response $response) { |
|
84 | + return $response; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * This is being run after the response object has been rendered and |
|
90 | - * allows the manipulation of the output. The middleware is run in reverse order |
|
91 | - * |
|
92 | - * @param Controller $controller the controller that is being called |
|
93 | - * @param string $methodName the name of the method that will be called on |
|
94 | - * the controller |
|
95 | - * @param string $output the generated output from a response |
|
96 | - * @return string the output that should be printed |
|
97 | - * @since 6.0.0 |
|
98 | - */ |
|
99 | - public function beforeOutput($controller, $methodName, $output) { |
|
100 | - return $output; |
|
101 | - } |
|
88 | + /** |
|
89 | + * This is being run after the response object has been rendered and |
|
90 | + * allows the manipulation of the output. The middleware is run in reverse order |
|
91 | + * |
|
92 | + * @param Controller $controller the controller that is being called |
|
93 | + * @param string $methodName the name of the method that will be called on |
|
94 | + * the controller |
|
95 | + * @param string $output the generated output from a response |
|
96 | + * @return string the output that should be printed |
|
97 | + * @since 6.0.0 |
|
98 | + */ |
|
99 | + public function beforeOutput($controller, $methodName, $output) { |
|
100 | + return $output; |
|
101 | + } |
|
102 | 102 | } |