PHP Class Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser

Inheritance: implements Symfony\Component\Form\FormTypeGuesserInterface
Show file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Public Methods

Method Description
__construct ( Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface $metadataFactory )
guessMaxLength ( $class, $property ) {@inheritDoc}
guessMaxLengthForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\Guess Guesses a field's maximum length based on the given constraint
guessMinLength ( $class, $property ) {@inheritDoc}
guessMinLengthForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\Guess Guesses a field's minimum length based on the given constraint
guessRequired ( $class, $property ) {@inheritDoc}
guessRequiredForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\Guess Guesses whether a field is required based on the given constraint
guessType ( $class, $property ) {@inheritDoc}
guessTypeForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\TypeGuess Guesses a field class name for a given constraint

Protected Methods

Method Description
guess ( string $class, string $property, Closure $guessForConstraint ) : Symfony\Component\Form\Guess\Guess Iterates over the constraints of a property, executes a constraints on them and returns the best guess

Method Details

__construct() public method

public __construct ( Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface $metadataFactory )
$metadataFactory Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface

guess() protected method

Iterates over the constraints of a property, executes a constraints on them and returns the best guess
protected guess ( string $class, string $property, Closure $guessForConstraint ) : Symfony\Component\Form\Guess\Guess
$class string The class to read the constraints from
$property string The property for which to find constraints
$guessForConstraint Closure The closure that returns a guess for a given constraint
return Symfony\Component\Form\Guess\Guess The guessed value with the highest confidence

guessMaxLength() public method

{@inheritDoc}
public guessMaxLength ( $class, $property )

guessMaxLengthForConstraint() public method

Guesses a field's maximum length based on the given constraint
public guessMaxLengthForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\Guess
$constraint Symfony\Component\Validator\Constraint The constraint to guess for
return Symfony\Component\Form\Guess\Guess The guess for the maximum length

guessMinLength() public method

{@inheritDoc}
public guessMinLength ( $class, $property )

guessMinLengthForConstraint() public method

Guesses a field's minimum length based on the given constraint
public guessMinLengthForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\Guess
$constraint Symfony\Component\Validator\Constraint The constraint to guess for
return Symfony\Component\Form\Guess\Guess The guess for the minimum length

guessRequired() public method

{@inheritDoc}
public guessRequired ( $class, $property )

guessRequiredForConstraint() public method

Guesses whether a field is required based on the given constraint
public guessRequiredForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\Guess
$constraint Symfony\Component\Validator\Constraint The constraint to guess for
return Symfony\Component\Form\Guess\Guess The guess whether the field is required

guessType() public method

{@inheritDoc}
public guessType ( $class, $property )

guessTypeForConstraint() public method

Guesses a field class name for a given constraint
public guessTypeForConstraint ( Constraint $constraint ) : Symfony\Component\Form\Guess\TypeGuess
$constraint Symfony\Component\Validator\Constraint The constraint to guess for
return Symfony\Component\Form\Guess\TypeGuess The guessed field class and options