UnauthorizedHttpException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
1
<?php
2
3
/*
4
 * http-exception (https://github.com/juliangut/http-exception).
5
 * HTTP aware exceptions.
6
 *
7
 * @license BSD-3-Clause
8
 * @link https://github.com/juliangut/http-exception
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Jgut\HttpException;
15
16
use Fig\Http\Message\StatusCodeInterface;
17
18
/**
19
 * HTTP 401 Unauthorized exception class.
20
 */
21
class UnauthorizedHttpException extends HttpException
22
{
23
    /**
24
     * @param string|null     $message
25
     * @param string|null     $description
26
     * @param int|null        $code
27
     * @param \Throwable|null $previous
28
     */
29
    public function __construct(
30
        string $message = null,
31
        string $description = null,
32
        int $code = null,
33
        \Throwable $previous = null
34
    ) {
35
        parent::__construct(
36
            $message ?? 'Unauthorized',
37
            $description ?? '',
38
            $code ?? StatusCodeInterface::STATUS_UNAUTHORIZED,
39
            StatusCodeInterface::STATUS_UNAUTHORIZED,
40
            $previous
41
        );
42
    }
43
}
44