Passed
Push — master ( 4bf73b...23e064 )
by Koen
09:19
created

Handler   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 43
ccs 4
cts 5
cp 0.8
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 5 1
A report() 0 7 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Exceptions;
6
7
use App\Http\Header;
8
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
9
use Throwable;
10
11
final class Handler extends ExceptionHandler
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  \Throwable $e
36
     * @return void
37
     *
38
     * @throws \Exception
39 14
     */
40
    public function report(Throwable $e)
41 14
    {
42
        if ($this->container->bound('sentry') && $this->shouldReport($e)) {
43
            $this->container->make('sentry')->captureException($e);
44
        }
45 14
46 14
        parent::report($e);
47
    }
48
49
    public function render($request, Throwable $e)
50
    {
51
        $request->headers->set(Header::ACCEPT, 'application/json');
52
53
        return parent::render($request, $e);
54
    }
55
}
56