Completed
Push — 6.13.7 ( b1546d )
by
unknown
14:00
created

PasswordValidator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validatePassword() 0 9 2
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace eZ\Publish\Core\Repository\User;
10
11
use eZ\Publish\API\Repository\Values\ContentType\FieldDefinition;
12
use eZ\Publish\Core\Repository\Validator\UserPasswordValidator;
13
14
/**
15
 * @internal
16
 */
17
final class PasswordValidator implements PasswordValidatorInterface
18
{
19
    /**
20
     * @return \eZ\Publish\SPI\FieldType\ValidationError[]
21
     */
22
    public function validatePassword(string $password, FieldDefinition $userFieldDefinition): array
23
    {
24
        $configuration = $userFieldDefinition->getValidatorConfiguration();
25
        if (!isset($configuration['PasswordValueValidator'])) {
26
            return [];
27
        }
28
29
        return (new UserPasswordValidator($configuration['PasswordValueValidator']))->validate($password);
30
    }
31
}
32