‪TYPO3CMS  ‪main
PasswordPolicy.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
22 
29 {
33  protected array ‪$validators = [];
34 
38  public function ‪__construct(array ‪$validators, protected ‪PasswordPolicyAction $action)
39  {
40  foreach (‪$validators as $validatorClassName => $validatorSettings) {
41  // Exclude validator if current action is defined as excludeAction
42  if (in_array($action, $validatorSettings['excludeActions'] ?? [], true)) {
43  continue;
44  }
45 
46  $this->validators[] = GeneralUtility::makeInstance(
47  $validatorClassName,
48  $validatorSettings['options'] ?? []
49  );
50  }
51  }
52 
54  {
55  return $this->action;
56  }
57 
58  public function ‪hasValidators(): bool
59  {
60  return !empty($this->validators);
61  }
62 
63  public function ‪getValidators(): array
64  {
65  return ‪$this->validators;
66  }
67 
74  public function ‪getRequirements(): array
75  {
76  $requirements = [];
77  foreach ($this->validators as ‪$validator) {
78  $requirements = array_merge($requirements, ‪$validator->getRequirements());
79  }
80 
81  return $requirements;
82  }
83 }
‪TYPO3\CMS\Core\PasswordPolicy\PasswordPolicy\getValidators
‪getValidators()
Definition: PasswordPolicy.php:63
‪TYPO3\CMS\Core\PasswordPolicy\PasswordPolicy
Definition: PasswordPolicy.php:29
‪TYPO3\CMS\Core\PasswordPolicy\PasswordPolicy\getAction
‪getAction()
Definition: PasswordPolicy.php:53
‪TYPO3\CMS\Core\PasswordPolicy\PasswordPolicy\getRequirements
‪getRequirements()
Definition: PasswordPolicy.php:74
‪TYPO3\CMS\Core\PasswordPolicy\PasswordPolicy\$validators
‪array $validators
Definition: PasswordPolicy.php:33
‪$validator
‪if(isset($args['d'])) $validator
Definition: validateRstFiles.php:262
‪TYPO3\CMS\Core\PasswordPolicy
‪TYPO3\CMS\Core\PasswordPolicy\Validator\AbstractPasswordValidator
Definition: AbstractPasswordValidator.php:31
‪TYPO3\CMS\Core\PasswordPolicy\PasswordPolicy\__construct
‪__construct(array $validators, protected PasswordPolicyAction $action)
Definition: PasswordPolicy.php:38
‪TYPO3\CMS\Core\PasswordPolicy\PasswordPolicy\hasValidators
‪hasValidators()
Definition: PasswordPolicy.php:58
‪TYPO3\CMS\Core\PasswordPolicy\PasswordPolicyAction
‪PasswordPolicyAction
Definition: PasswordPolicyAction.php:24
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51