1 | <?php |
||
15 | class RedirectCallback |
||
16 | { |
||
17 | /** |
||
18 | * @var RouteInterface |
||
19 | */ |
||
20 | private $router; |
||
21 | |||
22 | /** |
||
23 | * @var Application |
||
24 | */ |
||
25 | private $application; |
||
26 | |||
27 | /** |
||
28 | * @var ModuleOptions |
||
29 | */ |
||
30 | private $options; |
||
31 | |||
32 | /** |
||
33 | * @param Application $application |
||
34 | * @param RouteInterface $router |
||
35 | * @param ModuleOptions $options |
||
36 | */ |
||
37 | public function __construct(Application $application, RouteInterface $router, ModuleOptions $options) |
||
43 | |||
44 | /** |
||
45 | * @return Response |
||
46 | */ |
||
47 | public function __invoke() |
||
57 | |||
58 | /** |
||
59 | * Return the redirect from param. |
||
60 | * First checks GET then POST |
||
61 | * |
||
62 | * @return string|boolean |
||
63 | */ |
||
64 | private function getRedirectRouteFromRequest() |
||
79 | |||
80 | /** |
||
81 | * @param $route |
||
82 | * @return bool |
||
83 | */ |
||
84 | private function routeExists($route) |
||
93 | |||
94 | /** |
||
95 | * @param string $route |
||
96 | * @return bool |
||
97 | */ |
||
98 | private function routeMatched(string $route): bool |
||
104 | |||
105 | /** |
||
106 | * Returns the url to redirect to based on current route. |
||
107 | * If $redirect is set and the option to use redirect is set to true, it will return the $redirect url. |
||
108 | * |
||
109 | * @param string $currentRoute |
||
110 | * @param bool $redirect |
||
111 | * @return mixed |
||
112 | */ |
||
113 | private function getRedirect($currentRoute, $redirect = false) |
||
141 | } |
||
142 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.