Completed
Push — develop ( 7a0090...cf7e5a )
by Mohamed
07:32
created

Handler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 42
c 1
b 1
f 0
ccs 5
cts 6
cp 0.8333
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A report() 0 4 1
A render() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Tinyissue package.
5
 *
6
 * (c) Mohamed Alsharaf <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Tinyissue\Exceptions;
13
14
use Exception;
15
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
16
17
/**
18
 * Handler is a class to handler all of the application exceptions (reporting and rendering).
19
 *
20
 * @author Mohamed Alsharaf <[email protected]>
21
 */
22
class Handler extends ExceptionHandler
23
{
24
    /**
25
     * A list of the exception types that should not be reported.
26
     *
27
     * @var array
28
     */
29
    protected $dontReport = [
30
        'Symfony\Component\HttpKernel\Exception\HttpException',
31
    ];
32
33
    /**
34
     * Report or log an exception.
35
     *
36
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
37
     *
38
     * @param \Exception $e
39
     *
40
     * @return void
41
     */
42 13
    public function report(Exception $e)
43
    {
44 13
        return parent::report($e);
45
    }
46
47
    /**
48
     * Render an exception into an HTTP response.
49
     *
50
     * @param \Illuminate\Http\Request $request
51
     * @param \Exception               $e
52
     *
53
     * @return \Illuminate\Http\Response
54
     */
55 13
    public function render($request, Exception $e)
56
    {
57 13
        if ($this->isHttpException($e)) {
58 13
            return $this->renderHttpException($e);
0 ignored issues
show
Compatibility introduced by
$e of type object<Exception> is not a sub-type of object<Symfony\Component...xception\HttpException>. It seems like you assume a child class of the class Exception to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
59
        } else {
60
            return parent::render($request, $e);
61
        }
62
    }
63
}
64