summaryrefslogtreecommitdiff
path: root/src/Http/Exceptions/HttpException.php
blob: 6efc2fad42b9695a984cbeaea015046dbb8da892 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

namespace Engelsystem\Http\Exceptions;

use RuntimeException;
use Throwable;

class HttpException extends RuntimeException
{
    /** @var int */
    protected $statusCode;

    /** @var array */
    protected $headers = [];

    /**
     * @param int            $statusCode
     * @param string         $message
     * @param array          $headers
     * @param int            $code
     * @param Throwable|null $previous
     */
    public function __construct(
        int $statusCode,
        string $message = '',
        array $headers = [],
        int $code = 0,
        Throwable $previous = null
    ) {
        $this->headers = $headers;
        $this->statusCode = $statusCode;

        parent::__construct($message, $code, $previous);
    }

    /**
     * @return array
     */
    public function getHeaders(): array
    {
        return $this->headers;
    }

    /**
     * @return int
     */
    public function getStatusCode(): int
    {
        return $this->statusCode;
    }
}