Final Class Yiisoft\Validator\Helper\RulesNormalizerIterator
| Inheritance | Yiisoft\Validator\Helper\RulesNormalizerIterator |
|---|---|
| Implements | IteratorAggregate |
An iterator for a set of rules, performs normalization for every individual rule unifying other provided types and verifying that every item is a valid rule instance. It also applies some default settings if needed.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Validator\Helper\RulesNormalizerIterator | |
| getIterator() | Yiisoft\Validator\Helper\RulesNormalizerIterator |
Method Details
| public mixed __construct ( iterable $rules, callable|null $defaultSkipOnEmptyCondition = null ) | ||
| $rules | iterable |
A rules' iterable for checking and normalization. |
| $defaultSkipOnEmptyCondition | callable|null |
A default "skip on empty" condition
({@see \Yiisoft\Validator\SkipOnEmptyInterface}), already normalized. Used to optimize setting the same value in all the rules.
Defaults to |
public function __construct(
private readonly iterable $rules,
?callable $defaultSkipOnEmptyCondition = null,
) {
$this->defaultSkipOnEmptyCondition = $defaultSkipOnEmptyCondition;
}
| public Traversable getIterator ( ) |
public function getIterator(): Traversable
{
foreach ($this->rules as $rule) {
yield self::normalizeRule($rule, $this->defaultSkipOnEmptyCondition);
}
}
Signup or Login in order to comment.