Passed
Push — master ( 33d5ac...775805 )
by Dmitriy
03:03
created

UrlMatcherInterfaceProxy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 13
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A match() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Collector\Web;
6
7
use Psr\Http\Message\ServerRequestInterface;
8
use Yiisoft\Router\MatchingResult;
9
use Yiisoft\Router\UrlMatcherInterface;
10
11
final class UrlMatcherInterfaceProxy implements UrlMatcherInterface
12
{
13
    public function __construct(private UrlMatcherInterface $urlMatcher, private RouterCollector $routerCollector)
14
    {
15
    }
16
17
    public function match(ServerRequestInterface $request): MatchingResult
18
    {
19
        $timeStart = microtime(true);
20
        $result = $this->urlMatcher->match($request);
21
        $this->routerCollector->collect(microtime(true) - $timeStart);
22
23
        return $result;
24
    }
25
}
26