CustomServerErrorException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getStatusCode() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of the bugloos/error-response-bundle project.
5
 * (c) Bugloos <https://bugloos.com/>
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Bugloos\ErrorResponseBundle\Exception;
11
12
use Symfony\Component\HttpFoundation\Response;
13
14
/**
15
 * @author Mojtaba Gheytasi <[email protected]>
16
 */
17
class CustomServerErrorException extends \RuntimeException implements \Throwable
18
{
19
    private int $statusCode;
20
21
    public function __construct(string $message = 'Oops! Internal Server Error', int $statusCode = Response::HTTP_INTERNAL_SERVER_ERROR, \Throwable $previous = null, ?int $code = 0)
22
    {
23
        $this->statusCode = $statusCode;
24
25
        $this->message = $message;
26
27
        parent::__construct($message, $code, $previous);
28
    }
29
30
    public function getStatusCode(): int
31
    {
32
        return $this->statusCode;
33
    }
34
}
35