Passed
Push — master ( cfc2fe...4a62ef )
by Mike
03:28
created

MatchProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 38
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A match() 0 3 1
A __construct() 0 3 1
A matchRequest() 0 3 1
1
<?php
2
3
4
namespace Xervice\Routing\Business\Matcher;
5
6
7
use Symfony\Component\HttpFoundation\Request;
8
use Symfony\Component\Routing\Matcher\UrlMatcher;
9
10
class MatchProvider implements MatchProviderInterface
11
{
12
    /**
13
     * @var \Symfony\Component\Routing\Matcher\UrlMatcher
14
     */
15
    private $urlMatcher;
16
17
    /**
18
     * Matcher constructor.
19
     *
20
     * @param \Symfony\Component\Routing\Matcher\UrlMatcher $urlMatcher
21
     */
22 3
    public function __construct(UrlMatcher $urlMatcher)
23
    {
24 3
        $this->urlMatcher = $urlMatcher;
25 3
    }
26
27
    /**
28
     * @param string $url
29
     *
30
     * @return array
31
     * @throws \Symfony\Component\Routing\Exception\ResourceNotFoundException
32
     * @throws \Symfony\Component\Routing\Exception\NoConfigurationException
33
     * @throws \Symfony\Component\Routing\Exception\MethodNotAllowedException
34
     */
35 3
    public function match(string $url): array
36
    {
37 3
        return $this->urlMatcher->match($url);
38
    }
39
40
    /**
41
     * @param \Symfony\Component\HttpFoundation\Request $request
42
     *
43
     * @return array
44
     */
45
    public function matchRequest(Request $request): array
46
    {
47
        return $this->urlMatcher->matchRequest($request);
48
    }
49
}