Conditions | 4 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
19 | public function handle() |
||
20 | { |
||
21 | if ($this->exception instanceof AuthException) { |
||
22 | die('User must be logged in'); |
||
|
|||
23 | } elseif ($this->exception instanceof NotCallableException) { |
||
24 | die('Method not found'); |
||
25 | } |
||
26 | if ($this->exception instanceof MethodNotAllowedException) { |
||
27 | die('Not allowed'); |
||
28 | } else { |
||
29 | echo $this->exception->getMessage(); |
||
30 | } |
||
31 | } |
||
32 | } |
||
33 |
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.