PasswordType::isValid()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\Api\Scalar;
6
7
final class PasswordType extends AbstractStringBasedType
8
{
9
    public ?string $description = 'A password is a string of at least 12 characters';
10
11
    /**
12
     * Validate a password.
13
     */
14 14
    protected function isValid(?string $value): bool
15
    {
16 14
        return is_string($value) && mb_strlen($value) >= 12;
17
    }
18
}
19