Test Failed
Push — master ( 2cc1d9...298910 )
by Alexander
18:21 queued 15:33
created

UrlMatcherInterfaceProxy::getCurrentRoute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Proxy;
6
7
use Psr\Http\Message\ServerRequestInterface;
8
use Yiisoft\Router\MatchingResult;
9
use Yiisoft\Router\UrlMatcherInterface;
10
use Yiisoft\Yii\Debug\Collector\RouterCollectorInterface;
11
12
final class UrlMatcherInterfaceProxy implements UrlMatcherInterface
13
{
14
    private UrlMatcherInterface $urlMatcher;
15
    private RouterCollectorInterface $routerCollector;
16
17
    public function __construct(UrlMatcherInterface $urlMatcher, RouterCollectorInterface $routerCollector)
18
    {
19 1
        $this->urlMatcher = $urlMatcher;
20
        $this->routerCollector = $routerCollector;
21 1
    }
22 1
23 1
    public function match(ServerRequestInterface $request): MatchingResult
24
    {
25 1
        $timeStart = microtime(true);
26
        $result = $this->urlMatcher->match($request);
27 1
        $this->routerCollector->collect(microtime(true) - $timeStart);
28 1
29 1
        return $result;
30
    }
31
}
32