Passed
Push — 2.0 ( f5ddb0...24c833 )
by Samuel
02:58 queued 47s
created

Handler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 3
1
<?php
2
3
namespace SMartins\Exceptions\Tests\Fixtures\Exceptions;
4
5
use Exception;
6
use SMartins\Exceptions\JsonHandler;
7
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
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
        'password',
29
        'password_confirmation',
30
    ];
31
32
    /**
33
     * Report or log an exception.
34
     *
35
     * @param  \Exception  $exception
36
     * @return void
37
     */
38
    public function report(Exception $exception)
39
    {
40
        parent::report($exception);
41
    }
42
43
    /**
44
     * Render an exception into an HTTP response.
45
     *
46
     * @param  \Illuminate\Http\Request  $request
47
     * @param  \Exception  $exception
48
     * @return \Illuminate\Http\Response
49
     */
50
    public function render($request, Exception $exception)
51
    {
52
        if ($request->expectsJson()) {
53
            return $this->jsonResponse($exception);
54
        }
55
56
        return parent::render($request, $exception);
57
    }
58
}
59