everlutionsk /
navigation
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Everlution\Navigation\Match\Voter; |
||
|
0 ignored issues
–
show
Bug
introduced
by
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 |