Failed Conditions
Pull Request — master (#97)
by Jonathan
03:14
created

Pattern   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 18
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRegex() 0 3 1
A __construct() 0 3 1
A matches() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Inflector\Rules;
6
7
use function preg_match;
8
9
class Pattern
10
{
11
    /** @var string */
12
    private $regex;
13
14 530
    public function __construct(string $regex)
15
    {
16 530
        $this->regex = $regex;
17 530
    }
18
19 178
    public function getRegex() : string
20
    {
21 178
        return $this->regex;
22
    }
23
24 179
    public function matches(string $word) : bool
25
    {
26 179
        return preg_match($this->regex, $word) !== 0;
27
    }
28
}
29