Route::handler()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Northwoods\Router;
5
6
use Psr\Http\Server\RequestHandlerInterface;
7
8
class Route
9
{
10
    /** @var string */
11
    private $method;
12
13
    /** @var string */
14
    private $pattern;
15
16
    /** @var RequestHandlerInterface */
17
    private $handler;
18
19 15
    public function __construct(string $method, string $pattern, RequestHandlerInterface $handler)
20
    {
21 15
        $this->method = $method;
22 15
        $this->pattern = $pattern;
23 15
        $this->handler = $handler;
24 15
    }
25
26
    /**
27
     * Get the allowed HTTP method.
28
     */
29 9
    public function method(): string
30
    {
31 9
        return $this->method;
32
    }
33
34
    /**
35
     * Get the route pattern.
36
     */
37 12
    public function pattern(): string
38
    {
39 12
        return $this->pattern;
40
    }
41
42
    /**
43
     * Get the route handler.
44
     */
45 8
    public function handler(): RequestHandlerInterface
46
    {
47 8
        return $this->handler;
48
    }
49
}
50