Failed Conditions
Push — master ( 12e8b5...0c68f2 )
by Sylvain
18s queued 15s
created

OtpType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 3
c 1
b 0
f 0
dl 0
loc 13
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\Api\Scalar;
6
7
class OtpType extends AbstractStringBasedType
8
{
9
    /**
10
     * @var string
11
     */
12
    public $description = 'One time passcode composed of only digits';
13
14
    /**
15
     * Validate an OTP.
16
     */
17 12
    protected function isValid(?string $value): bool
18
    {
19 12
        return is_string($value) && preg_match('/^\d{6}+$/', $value);
20
    }
21
}
22