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

MatchProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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
}