Handler::render()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Exceptions;
4
5
use ArinaSystems\JsonResponse\Traits\JsonHandler;
6
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
7
use Throwable;
8
9
class Handler extends ExceptionHandler
10
{
11
    use JsonHandler;
12
13
    /**
14
     * A list of the exception types that are not reported.
15
     *
16
     * @var array
17
     */
18
    protected $dontReport = [
19
        //
20
    ];
21
22
    /**
23
     * A list of the inputs that are never flashed for validation exceptions.
24
     *
25
     * @var array
26
     */
27
    protected $dontFlash = [
28
        'current_password',
29
        'password',
30
        'password_confirmation',
31
    ];
32
33
    /**
34
     * Register the exception handling callbacks for the application.
35
     *
36
     * @return void
37
     */
38
    public function register()
39
    {
40
        // $this->reportable(function (Throwable $e) {
41
        //     //
42
        // });
43
    }
44
45
    /**
46
     * Render an exception into an HTTP response.
47
     *
48
     * @param  \Illuminate\Http\Request                     $request
49
     * @param  \Throwable                                   $exception
50
     * @throws \Throwable
51
     * @return \Symfony\Component\HttpFoundation\Response
52
     */
53
    public function render($request, Throwable $exception)
54
    {
55
        if ($request->wantsJson()) {
56
            return $this->renderForJson($exception);
57
        }
58
59
        return parent::render($request, $exception);
60
    }
61
}
62