Completed
Branch master (802455)
by n
03:24
created

RoutingSuccess   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 34
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A isSuccess() 0 4 1
A getMatchedHandler() 0 4 1
A getMatchedParams() 0 4 1
A getError() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace N1215\Http\Router\Result;
5
6
use N1215\Http\Router\RoutingErrorInterface;
7
use N1215\Http\Router\RoutingResultInterface;
8
use Psr\Http\Server\RequestHandlerInterface;
9
10
final class RoutingSuccess implements RoutingResultInterface
11
{
12
    /** @var RequestHandlerInterface|null  */
13
    private $matchedHandler;
14
15
    /** @var array  */
16
    private $matchedParams;
17
18 3
    public function __construct(?RequestHandlerInterface $matchedHandler, array $matchedParams = [])
19
    {
20 3
        $this->matchedHandler = $matchedHandler;
21 3
        $this->matchedParams = $matchedParams;
22 3
    }
23
24 3
    public function isSuccess(): bool
25
    {
26 3
        return true;
27
    }
28
29 3
    public function getMatchedHandler(): ?RequestHandlerInterface
30
    {
31 3
        return $this->matchedHandler;
32
    }
33
34 3
    public function getMatchedParams(): array
35
    {
36 3
        return $this->matchedParams;
37
    }
38
39 2
    public function getError(): ?RoutingErrorInterface
40
    {
41 2
        return null;
42
    }
43
}
44