ValidationRules
class ValidationRules (View source)
Properties
| protected int | $nodes | The number of schema fragments converted so far. |
Methods
Get the rules for each property of an object schema, keyed under the given prefix.
Get the rules for one value and everything nested inside it.
Get the rules that decide when the value must be present.
Get the rules for the items or properties nested inside the value.
Get the rules a value of the given type must pass.
Get the length, pattern, and format rules for a string schema.
Get the rules for the given string format.
Get the bound and "multiple_of" rules for a numeric schema.
Get the rules an array value must pass.
Get the rules an object value must pass.
Get the rule that restricts the value to the schema's enumerated values.
Get the rule that passes when the value matches any of the given schemas.
Get the "min" and "max" rules for the given schema keywords.
Get the types the schema allows, other than "null".
Determine if the schema allows a null value.
Join the given values into a quoted rule parameter list.
Escape each "/" in the pattern that is not already escaped by an odd number of backslashes.
Details
static array
for(Type|array $schema)
Get the validation rules for the properties of the given object schema.
protected array
properties(array $schema, string|null $prefix = null)
Get the rules for each property of an object schema, keyed under the given prefix.
protected array
rules(array $schema, string $attribute, bool $required, bool $nested = false)
Get the rules for one value and everything nested inside it.
protected array
presenceRules(array $schema, bool $required, bool $nested)
Get the rules that decide when the value must be present.
protected array
nestedRules(string|null $type, array $schema, string $attribute)
Get the rules for the items or properties nested inside the value.
protected array
typeRules(string|null $type, array $schema)
Get the rules a value of the given type must pass.
protected array
stringRules(array $schema)
Get the length, pattern, and format rules for a string schema.
protected array
formatRules(string|null $format)
Get the rules for the given string format.
protected array
numberRules(array $schema)
Get the bound and "multiple_of" rules for a numeric schema.
protected array
arrayRules(array $schema)
Get the rules an array value must pass.
protected array
objectRules(array $schema)
Get the rules an object value must pass.
protected array
enumRules(array $schema)
Get the rule that restricts the value to the schema's enumerated values.
protected MatchesAnyOf
anyOf(array $schemas)
Get the rule that passes when the value matches any of the given schemas.
protected array
bounds(array $schema, string $min, string $max)
Get the "min" and "max" rules for the given schema keywords.
protected array
types(array $schema)
Get the types the schema allows, other than "null".
protected bool
isNullable(array $schema)
Determine if the schema allows a null value.
protected string
parameters(array $values)
Join the given values into a quoted rule parameter list.
protected string
escapeDelimiter(string $pattern)
Escape each "/" in the pattern that is not already escaped by an odd number of backslashes.