Completed
Push — master ( 528eb4...5ffde5 )
by n
01:41
created

Route   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 33
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A match() 0 4 1
A getHandler() 0 4 1
A getName() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace N1215\Hakudo;
5
6
use Interop\Http\Server\RequestHandlerInterface;
7
use N1215\Http\RequestMatcher\RequestMatcherInterface;
8
use N1215\Http\RequestMatcher\RequestMatchResultInterface;
9
use Psr\Http\Message\ServerRequestInterface;
10
11
class Route
12
{
13
    /** @var string  */
14
    private $name;
15
16
    /** @var RequestMatcherInterface  */
17
    private $matcher;
18
19
    /** @var RequestHandlerInterface  */
20
    private $handler;
21
22 5
    public function __construct(string $name, RequestMatcherInterface $matcher, RequestHandlerInterface $handler)
23
    {
24 5
        $this->name = $name;
25 5
        $this->matcher = $matcher;
26 5
        $this->handler = $handler;
27 5
    }
28
29 1
    public function getName(): string
30
    {
31 1
        return $this->name;
32
    }
33
34 3
    public function match(ServerRequestInterface $request): RequestMatchResultInterface
35
    {
36 3
        return $this->matcher->match($request);
37
    }
38
39 2
    public function getHandler(): RequestHandlerInterface
40
    {
41 2
        return $this->handler;
42
    }
43
}
44