Test Failed
Pull Request — master (#133)
by Rustam
03:14
created

UrlMatcherInterfaceProxy   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A match() 0 7 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Collector;
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
    private UrlMatcherInterface $urlMatcher;
14
    private RouterCollector $routerCollector;
15
16
    public function __construct(UrlMatcherInterface $urlMatcher, RouterCollector $routerCollector)
17
    {
18
        $this->urlMatcher = $urlMatcher;
19
        $this->routerCollector = $routerCollector;
20
    }
21
22
    public function match(ServerRequestInterface $request): MatchingResult
23
    {
24
        $timeStart = microtime(true);
25
        $result = $this->urlMatcher->match($request);
26
        $this->routerCollector->collect(microtime(true) - $timeStart);
27
28
        return $result;
29
    }
30
}
31