Handler::report()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace App\Exceptions;
4
5
use Exception;
6
use Illuminate\Validation\ValidationException;
7
use Illuminate\Auth\Access\AuthorizationException;
8
use Illuminate\Database\Eloquent\ModelNotFoundException;
9
use Symfony\Component\HttpKernel\Exception\HttpException;
10
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
11
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
12
13
class Handler extends ExceptionHandler
14
{
15
    /**
16
     * A list of the exception types that should not be reported.
17
     *
18
     * @var array
19
     */
20
    protected $dontReport = [
21
        AuthorizationException::class,
22
        HttpException::class,
23
        ModelNotFoundException::class,
24
        ValidationException::class,
25
    ];
26
27
    /**
28
     * Report or log an exception.
29
     *
30
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
31
     *
32
     * @param  \Exception  $e
33
     * @return void
34
     */
35
    public function report(Exception $e)
36
    {
37
        parent::report($e);
38
    }
39
40
    /**
41
     * Render an exception into an HTTP response.
42
     *
43
     * @param  \Illuminate\Http\Request  $request
44
     * @param  \Exception  $e
45
     * @return \Illuminate\Http\Response
46
     */
47
    public function render($request, Exception $e)
48
    {
49
        if($e instanceof NotFoundHttpException)
50
        {
51
//            return response()->view('404', [], 404);
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
52
            return response()->view('404', compact('e'), 404);
53
        }
54
55
        return parent::render($request, $e);
56
    }
57
}
58