vendor/ezsystems/ezplatform-kernel/eZ/Publish/Core/Repository/User/PasswordValidator.php line 17

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