Completed
Push — master ( 310596...ecf895 )
by Hannes
02:21
created

Alphanum   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 12
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 0 4 1
A isMatch() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace byrokrat\autogiro\Parser\Matcher;
6
7
/**
8
 * Matcher for alphanumeric content
9
 */
10
class Alphanum extends BaseMatcher
11
{
12 1
    protected function getDescription(): string
13
    {
14 1
        return 'alphanum';
15
    }
16
17 2
    protected function isMatch(string $str): bool
18
    {
19 2
        return !!preg_match('/^[A-Za-zÅÄÖåäö0-9 -\/.&]*$/', $str);
20
    }
21
}
22