Passed
Push — master ( cfceb1...4bf73b )
by Koen
09:48
created

Handler   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A report() 0 7 3
A unauthenticated() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Exceptions;
6
7
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8
use Throwable;
9
10
final class Handler extends ExceptionHandler
11
{
12
    /**
13
     * A list of the exception types that are not reported.
14
     *
15
     * @var array
16
     */
17
    protected $dontReport = [
18
        //
19
    ];
20
21
    /**
22
     * A list of the inputs that are never flashed for validation exceptions.
23
     *
24
     * @var array
25
     */
26
    protected $dontFlash = [
27
        'password',
28
        'password_confirmation',
29
    ];
30
31
    /**
32
     * Report or log an exception.
33
     *
34
     * @param  \Throwable $e
35
     * @return void
36
     *
37
     * @throws \Exception
38
     */
39 14
    public function report(Throwable $e)
40
    {
41 14
        if ($this->container->bound('sentry') && $this->shouldReport($e)) {
42
            $this->container->make('sentry')->captureException($e);
43
        }
44
45 14
        parent::report($e);
46 14
    }
47
48
    protected function unauthenticated($request, AuthenticationException $exception)
0 ignored issues
show
Bug introduced by
The type App\Exceptions\AuthenticationException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
49
    {
50
        return $this->container->make(ResponseFactory::class)->json(['message' => $exception->getMessage()], 401);
0 ignored issues
show
Bug introduced by
The type App\Exceptions\ResponseFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
51
    }
52
}
53