1 | <?php |
||
15 | class Http extends AbstractHttp |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * Redirect to specific uri path |
||
20 | * |
||
21 | * @param string $location The path as string |
||
22 | * @param integer $code The status code |
||
23 | * @return mixed |
||
24 | * @throws InvalidArgumentException |
||
25 | */ |
||
26 | public function redirect(string $location, int $code = 301) |
||
35 | |||
36 | /** |
||
37 | * Workaround to mock this method in phpunit |
||
38 | * |
||
39 | * @param string $location |
||
40 | * @param int $code |
||
41 | * |
||
42 | * @codeCoverageIgnore |
||
43 | * @return void |
||
44 | */ |
||
45 | protected function triggerRedirect($location = '/', $code = 301) |
||
52 | |||
53 | } |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.