Route   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 10
dl 0
loc 40
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A method() 0 3 1
A pattern() 0 3 1
A handler() 0 3 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