1 | <?php |
||
14 | class RedirectCallback |
||
15 | { |
||
16 | |||
17 | /** @var RouteInterface */ |
||
18 | private $router; |
||
19 | |||
20 | /** @var Application */ |
||
21 | private $application; |
||
22 | |||
23 | /** @var ModuleOptions */ |
||
24 | private $options; |
||
25 | |||
26 | /** |
||
27 | * @param Application $application |
||
28 | * @param RouteInterface $router |
||
29 | * @param ModuleOptions $options |
||
30 | */ |
||
31 | public function __construct(Application $application, RouteInterface $router, ModuleOptions $options) |
||
37 | |||
38 | /** |
||
39 | * @return Response |
||
40 | */ |
||
41 | public function __invoke() |
||
51 | |||
52 | /** |
||
53 | * Return the redirect from param. |
||
54 | * First checks GET then POST |
||
55 | * @return string |
||
56 | */ |
||
57 | private function getRedirectRouteFromRequest() |
||
72 | |||
73 | /** |
||
74 | * @param $route |
||
75 | * @return bool |
||
76 | */ |
||
77 | private function routeExists($route) |
||
86 | |||
87 | /** |
||
88 | * Returns the url to redirect to based on current route. |
||
89 | * If $redirect is set and the option to use redirect is set to true, it will return the $redirect url. |
||
90 | * |
||
91 | * @param string $currentRoute |
||
92 | * @param bool $redirect |
||
93 | * @return mixed |
||
94 | */ |
||
95 | protected function getRedirect($currentRoute, $redirect = false) |
||
118 | } |
||
119 |