1 | <?php |
||
2 | namespace Gvera\Controllers; |
||
3 | |||
4 | use Gvera\Helpers\dependencyInjection\DIContainer; |
||
5 | use Gvera\Helpers\http\JSONResponse; |
||
6 | use Gvera\Helpers\http\Response; |
||
7 | use Throwable; |
||
8 | |||
9 | class Doc extends GvController |
||
10 | { |
||
11 | public function index() |
||
12 | { |
||
13 | try { |
||
14 | $this->mustPassBasicAuthentication(); |
||
15 | } catch (Throwable $e) { |
||
16 | $this->httpResponse->response( |
||
17 | new JSONResponse( |
||
18 | ['message' => $e->getMessage()], |
||
19 | Response::HTTP_RESPONSE_UNAUTHORIZED, |
||
20 | Response::BASIC_AUTH_ACCESS_DENIED |
||
21 | ) |
||
22 | ); |
||
23 | exit; |
||
0 ignored issues
–
show
|
|||
24 | } |
||
25 | } |
||
26 | } |
||
27 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.