/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/Validation
NameSizeModeActions
composer.json10270644editdlrm
LICENSE.txt12040644editdlrm
README.md12170644editdlrm
RulesProvider.php25440644editdlrm
ValidatableInterface.php11310644editdlrm
Validation.php617860644editdlrm
ValidationRule.php64880644editdlrm
ValidationSet.php56590644editdlrm
Validator.php1036080644editdlrm
ValidatorAwareInterface.php17310644editdlrm
ValidatorAwareTrait.php69630644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/Validation/ValidationSet.php (5659B)
*/ protected $_rules = []; /** * Denotes whether the fieldname key must be present in data array * * @var callable|string|bool */ protected $_validatePresent = false; /** * Denotes if a field is allowed to be empty * * @var callable|string|bool */ protected $_allowEmpty = false; /** * Returns whether a field can be left out. * * @return callable|string|bool */ public function isPresenceRequired() { return $this->_validatePresent; } /** * Sets whether a field is required to be present in data array. * * @param callable|string|bool $validatePresent Valid values are true, false, 'create', 'update' or a callable. * @return $this */ public function requirePresence($validatePresent) { $this->_validatePresent = $validatePresent; return $this; } /** * Returns whether a field can be left empty. * * @return callable|string|bool */ public function isEmptyAllowed() { return $this->_allowEmpty; } /** * Sets whether a field value is allowed to be empty. * * @param callable|string|bool $allowEmpty Valid values are true, false, * 'create', 'update' or a callable. * @return $this */ public function allowEmpty($allowEmpty) { $this->_allowEmpty = $allowEmpty; return $this; } /** * Gets a rule for a given name if exists * * @param string $name The name under which the rule is set. * @return \Cake\Validation\ValidationRule|null */ public function rule(string $name): ?ValidationRule { if (!empty($this->_rules[$name])) { return $this->_rules[$name]; } return null; } /** * Returns all rules for this validation set * * @return array<\Cake\Validation\ValidationRule> */ public function rules(): array { return $this->_rules; } /** * Sets a ValidationRule $rule with a $name * * ### Example: * * ``` * $set * ->add('notBlank', ['rule' => 'notBlank']) * ->add('inRange', ['rule' => ['between', 4, 10]) * ``` * * @param string $name The name under which the rule should be set * @param \Cake\Validation\ValidationRule|array $rule The validation rule to be set * @return $this */ public function add(string $name, $rule) { if (!($rule instanceof ValidationRule)) { $rule = new ValidationRule($rule); } $this->_rules[$name] = $rule; return $this; } /** * Removes a validation rule from the set * * ### Example: * * ``` * $set * ->remove('notBlank') * ->remove('inRange') * ``` * * @param string $name The name under which the rule should be unset * @return $this */ public function remove(string $name) { unset($this->_rules[$name]); return $this; } /** * Returns whether an index exists in the rule set * * @param string $index name of the rule * @return bool */ public function offsetExists($index): bool { return isset($this->_rules[$index]); } /** * Returns a rule object by its index * * @param string $index name of the rule * @return \Cake\Validation\ValidationRule */ public function offsetGet($index): ValidationRule { return $this->_rules[$index]; } /** * Sets or replace a validation rule * * @param string $index name of the rule * @param \Cake\Validation\ValidationRule|array $rule Rule to add to $index * @return void */ public function offsetSet($index, $rule): void { $this->add($index, $rule); } /** * Unsets a validation rule * * @param string $index name of the rule * @return void */ public function offsetUnset($index): void { unset($this->_rules[$index]); } /** * Returns an iterator for each of the rules to be applied * * @return \Traversable */ public function getIterator(): Traversable { return new ArrayIterator($this->_rules); } /** * Returns the number of rules in this set * * @return int */ public function count(): int { return count($this->_rules); } }