Nip   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMessage() 0 7 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Hop\Validator\Validator;
6
7
class Nip implements RuleValidator
8
{
9
    use IsValidTrait;
10
11
    /**
12
     * @inheritdoc
13
     */
14 2
    public function getMessage($value, ?array $options)
15
    {
16 2
        if (!preg_match('/^[a-z]{2}\d{10}$/i', (string)$value)) {
17 1
            return 'Pattern does not match polish NIP';
18
        }
19
20 1
        return null;
21
    }
22
}
23