Passed
Branch master (6982d9)
by Ivan
02:35
created

RegexMatchVoter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A matches() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Everlution\Navigation\Match\Voter;
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($url, $match->getValue());
24
    }
25
}
26