MethodNotAllowedException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.6666
cc 1
eloc 7
nc 1
nop 3
crap 1
1
<?php
2
3
namespace IdNet\InvokerRouterMiddleware\Exception;
4
5
use Exception;
6
use Psr\Http\Message\ServerRequestInterface;
7
8
class MethodNotAllowedException extends Exception
9
{
10
    /** @var ServerRequestInterface */
11
    protected $request;
12
13
    protected $allowedMethods = [];
14
15 3
    public function __construct(
16
        ServerRequestInterface $request,
17
        $allowedMethods,
18
        $code = 405
19
    ) {
20 3
        $this->request = $request;
21 3
        $this->allowedMethods = $allowedMethods;
22 3
        parent::__construct("Method not allowed", $code);
23 3
    }
24
25 1
    public function getRequest()
26
    {
27 1
        return $this->request;
28
    }
29
30 1
    public function getAllowedMethods()
31
    {
32 1
        return $this->allowedMethods;
33
    }
34
}
35