Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
58 | public function run() |
||
59 | { |
||
60 | if (!headers_sent()) { |
||
61 | // for now we do not throw an exception here if headers were already sent as it could break |
||
62 | // users app and in worst case people would simply instead see the original version if headers |
||
63 | // were already sent so should be fine for now |
||
64 | $url = $this->getUrlWithExperimentParameters(); |
||
65 | header('Location: ' . $url, true, 302); |
||
66 | exit; |
||
1 ignored issue
–
show
|
|||
67 | } |
||
68 | } |
||
69 | } |
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.