public function GetterMetadata::__construct

Constructor.

Parameters

string $class The class the getter is defined on:

string $property The property which the getter returns:

Throws

ValidatorException

Overrides MemberMetadata::__construct

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Mapping/GetterMetadata.php, line 26

Class

GetterMetadata

Namespace

Symfony\Component\Validator\Mapping

Code

public function __construct($class, $property) {
  $getMethod = 'get' . ucfirst($property);
  $isMethod = 'is' . ucfirst($property);
  if (method_exists($class, $getMethod)) {
    $method = $getMethod;
  }
  elseif (method_exists($class, $isMethod)) {
    $method = $isMethod;
  }
  else {
    throw new ValidatorException(sprintf('Neither method %s nor %s exists in class %s', $getMethod, $isMethod, $class));
  }
  parent::__construct($class, $method, $property);
}