PHP Class Symfony\Component\Validator\ConstraintValidator

Author: Bernhard Schussek ([email protected])
Inheritance: implements Symfony\Component\Validator\ConstraintValidatorInterface
Afficher le fichier Open project: symfony/validator Class Usage Examples

Protected Properties

Свойство Type Description
$context ExecutionContextInterface2Dot5

Méthodes publiques

Méthode Description
initialize ( Symfony\Component\Validator\Context\ExecutionContextInterface $context )

Méthodes protégées

Méthode Description
formatTypeOf ( mixed $value ) : string Returns a string representation of the type of the value.
formatValue ( mixed $value, integer $format ) : string Returns a string representation of the value.
formatValues ( array $values, integer $format ) : string Returns a string representation of a list of values.

Method Details

formatTypeOf() protected méthode

This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people.
protected formatTypeOf ( mixed $value ) : string
$value mixed The value to return the type of
Résultat string The type of the value

formatValue() protected méthode

This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message.
protected formatValue ( mixed $value, integer $format ) : string
$value mixed The value to format as string
$format integer A bitwise combination of the format constants in this class
Résultat string The string representation of the passed value

formatValues() protected méthode

Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas.
See also: formatValue()
protected formatValues ( array $values, integer $format ) : string
$values array A list of values
$format integer A bitwise combination of the format constants in this class
Résultat string The string representation of the value list

initialize() public méthode

public initialize ( Symfony\Component\Validator\Context\ExecutionContextInterface $context )
$context Symfony\Component\Validator\Context\ExecutionContextInterface

Property Details

$context protected_oe property

protected ExecutionContextInterface2Dot5 $context
Résultat ExecutionContextInterface2Dot5