UnprocessableEntityHttpException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 4
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 422 Unprocessable Entity exception class.
20
 */
21
class UnprocessableEntityHttpException extends HttpException
22
{
23
    /**
24
     * Unprocessable Entity Exception constructor.
25
     *
26
     * @param string|null     $message
27
     * @param string|null     $description
28
     * @param int|null        $code
29
     * @param \Throwable|null $previous
30
     */
31
    public function __construct(
32
        string $message = null,
33
        string $description = null,
34
        int $code = null,
35
        \Throwable $previous = null
36
    ) {
37
        parent::__construct(
38
            $message ?? 'Unprocessable Entity',
39
            $description ?? '',
40
            $code ?? StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
41
            StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY,
42
            $previous
43
        );
44
    }
45
}
46