Test Failed
Push — master ( 3eb0e4...9196b6 )
by Ivan
02:13
created

RegexVoter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A matches() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Everlution\Navigation\Voter\Regex;
6
7
use Everlution\Navigation\Voter\MatchVoter;
8
9
/**
10
 * Class RegexVoter.
11
 * @author Ivan Barlog <[email protected]>
12
 */
13
class RegexVoter extends MatchVoter
14
{
15
    /**
16
     * @param string $haystack
17
     * @param string $needle
18
     * @return bool
19
     */
20
    protected function matches(string $haystack, string $needle): bool
21
    {
22
        return 1 === preg_match($needle, $haystack);
23
    }
24
}
25