public function FakeMetadataFactory::getMetadataFor

Returns the metadata for the given value.

Parameters

mixed $value Some value.:

Return value

MetadataInterface The metadata for the value.

Throws

Exception\NoSuchMetadataException If no metadata exists for the value.

Overrides MetadataFactoryInterface::getMetadataFor

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php, line 22

Class

FakeMetadataFactory

Namespace

Symfony\Component\Validator\Tests\Fixtures

Code

public function getMetadataFor($class) {
  if (is_object($class)) {
    $class = get_class($class);
  }
  if (!is_string($class)) {
    throw new NoSuchMetadataException(sprintf('No metadata for type %s', gettype($class)));
  }
  if (!isset($this->metadatas[$class])) {
    throw new NoSuchMetadataException(sprintf('No metadata for "%s"', $class));
  }
  return $this->metadatas[$class];
}