You are here

public function LazyLoadingMetadataFactory::hasMetadataFor in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php \Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory::hasMetadataFor()

Returns whether the class is able to return metadata for the given value.

Parameters

mixed $value Some value:

Return value

bool Whether metadata can be returned for that value

Overrides MetadataFactoryInterface::hasMetadataFor

File

vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php, line 141

Class

LazyLoadingMetadataFactory
Creates new {@link ClassMetadataInterface} instances.

Namespace

Symfony\Component\Validator\Mapping\Factory

Code

public function hasMetadataFor($value) {
  if (!is_object($value) && !is_string($value)) {
    return false;
  }
  $class = ltrim(is_object($value) ? get_class($value) : $value, '\\');
  if (class_exists($class) || interface_exists($class)) {
    return true;
  }
  return false;
}