RequestException::getRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace inroutephp\inroute\Runtime\Exception;
6
7
use inroutephp\inroute\Exception;
8
use Psr\Http\Message\ServerRequestInterface;
9
10
class RequestException extends \RuntimeException implements Exception
11
{
12
    /**
13
     * @var ServerRequestInterface
14
     */
15
    private $request;
16
17
    /**
18
     * @var array<string, mixed>
19
     */
20
    private $context;
21
22
    /**
23
     * @param array<string, mixed> $context
24
     */
25
    public function __construct(string $message, int $code, ServerRequestInterface $request, array $context = [])
26
    {
27
        parent::__construct($message, $code);
28
        $this->request = $request;
29
        $this->context = $context;
30
    }
31
32
    public function getRequest(): ServerRequestInterface
33
    {
34
        return $this->request;
35
    }
36
37
    /**
38
     * @return array<string, mixed>
39
     */
40
    public function getContext(): array
41
    {
42
        return $this->context;
43
    }
44
}
45