PrintConstraint
final class PrintConstraint extends Rule (View source)
Adds print
rule. Asserts that the input consists of printable characters only.
This is an auto-generated class that was generated programmatically by:
MAKS\Mighty\Maker
Constants
NAME |
|
Properties
protected array<string,string|null> | $messages | Constraint rules messages overrides. |
from Constraint |
protected Strategy | $strategy | Constraint strategy. |
from Constraint |
protected string | $validation | Constraint validation expression. |
from Constraint |
protected Validator
Since: 1.2.0
|
$validator | Constraint validator instance. |
from Constraint |
Methods
Rule constructor.
Checks if the given value is valid and throws an exception if not.
Returns the master Validator instance that should be used in validation.
Details
__construct(string|null $message = null, Strategy $strategy = Strategy::FailLazy)
Rule constructor.
void
check(mixed $value = null)
Checks if the given value is valid and throws an exception if not.
final static protected Validator
getMasterValidator()
Returns the master Validator instance that should be used in validation.
NOTE: All constraint share the same Validator. Always clone it to avoid any side effects.
FACT: The idea of master Validator is used to allow for better memory management and faster load times as the default Validator loads 200+ rules by default. Cloning will make a shallow copy resulting in reusing the same rules loaded by the master Validator.
array
getMessages()
Gets constraint rules messages overrides.
Strategy
getStrategy()
Gets constraint strategy.
string
getValidation()
Gets constraint validation expression.
Validator
getValidator()
Gets constraint validator instance.
This method returns a clone of the master Validator
if a Validator is not set explicitly via self::setValidator()
.
bool
isValid(mixed $value = null)
Checks if the given value is valid.
Constraint
setMessages(array $messages)
Sets constraint rules messages overrides.
Constraint
setStrategy(Strategy $strategy)
Sets constraint strategy.
Constraint
setValidation(string $validation)
Sets constraint validation expression.
Constraint
setValidator(Validator $validator)
Sets constraint validator instance.
in
Rule at line 58
Result
validate(mixed $value = null)
Validates the given value and returns the validation result.