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