RequestMatchResult::failure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace N1215\Http\RequestMatcher;
5
6
final class RequestMatchResult implements RequestMatchResultInterface
7
{
8
    /** @var bool */
9
    private $isSuccess;
10
11
    /** @var array */
12
    private $params;
13
14 5
    private function __construct(bool $isSuccess, array $params = [])
15
    {
16 5
        $this->isSuccess = $isSuccess;
17 5
        $this->params = $params;
18 5
    }
19
20 5
    public function isSuccess(): bool
21
    {
22 5
        return $this->isSuccess;
23
    }
24
25 4
    public function getParams(): array
26
    {
27 4
        return $this->params;
28
    }
29
30 2
    public static function success(array $params): self
31
    {
32 2
        return new self(true, $params);
33
    }
34
35 3
    public static function failure(): self
36
    {
37 3
        return new self(false);
38
    }
39
}
40