Passed
Pull Request — master (#5)
by Ivan
01:48
created

PrefixMatchVoter::matches()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 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 PrefixMatchVoter.
12
 *
13
 * @author Ivan Barlog <[email protected]>
14
 */
15
class PrefixMatchVoter implements VoterInterface
16
{
17
    public function matches(string $url, MatchInterface $match): bool
18
    {
19
        if (false === $match instanceof PrefixMatch) {
20
            return false;
21
        }
22
23
        return 0 === strpos($match->getValue(), $url);
24
    }
25
}
26