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

PrefixMatchVoter::matches()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 2
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 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($url, $match->getValue());
24
    }
25
}
26