Passed
Pull Request — master (#43)
by Mostafa Abd El-Salam
04:46
created

UnauthorizedException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 14
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2.1481

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 14
loc 14
ccs 4
cts 6
cp 0.6667
rs 9.4285
cc 2
eloc 10
nc 2
nop 5
crap 2.1481
1
<?php
2
3
namespace Maklad\Permission\Exceptions;
4
5
use http\Exception;
6
use Symfony\Component\HttpKernel\Exception\HttpException;
7
8
/**
9
 * Class UnauthorizedException
10
 * @package Maklad\Permission\Exceptions
11
 */
12
class UnauthorizedException extends HttpException
13
{
14
15
    /**
16
     * UnauthorizedException constructor.
17
     *
18
     * @param $statusCode
19
     * @param null $message
20
     * @param Exception $previous
21
     * @param array $headers
22
     * @param int $code
23
     */
24 7 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
        $statusCode,
26
        $message = null,
27
        Exception $previous = null,
28
        array $headers = array(),
29
        $code = 0
30
    ) {
31 7
        parent::__construct($statusCode, $message, $previous, $headers, $code);
32
33 7
        if (\config('permission.log_registration_exception')) {
34
            $logger = \app('log');
35
            $logger->alert($message);
36
        }
37 7
    }
38
}
39