Passed
Push — master ( fba5ec...ac8f64 )
by Ivan
02:15
created

RegexMatchVoter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Everlution\Navigation\Match\Voter;
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_MATCH, expecting T_STRING on line 5 at column 32
Loading history...
6
7
use Everlution\Navigation\Match\MatchInterface;
8
use Everlution\Navigation\Match\VoterInterface;
9
10
/**
11
 * Class RegexMatchVoter.
12
 *
13
 * @author Ivan Barlog <[email protected]>
14
 */
15
class RegexMatchVoter implements VoterInterface
16
{
17
    public function matches(string $url, MatchInterface $match): bool
18
    {
19
        if (false === $match instanceof RegexMatch) {
20
            return false;
21
        }
22
23
        return 1 === preg_match($match->getValue(), $url);
24
    }
25
}
26