You are here

public function Constraint::__get in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Constraint.php \Symfony\Component\Validator\Constraint::__get()

Returns the value of a lazily initialized option.

Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name.

@internal This method should not be used or overwritten in userland code.

@since 2.6

Parameters

string $option The option name:

Return value

mixed The value of the option

Throws

InvalidOptionsException If an invalid option name is given

1 call to Constraint::__get()
File::__get in vendor/symfony/validator/Constraints/File.php
Returns the value of a lazily initialized option.
1 method overrides Constraint::__get()
File::__get in vendor/symfony/validator/Constraints/File.php
Returns the value of a lazily initialized option.

File

vendor/symfony/validator/Constraint.php, line 213

Class

Constraint
Contains the properties of a constraint definition.

Namespace

Symfony\Component\Validator

Code

public function __get($option) {
  if ('groups' === $option) {
    $this->groups = array(
      self::DEFAULT_GROUP,
    );
    return $this->groups;
  }
  throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array(
    $option,
  ));
}