You are here

public function LazyLoadingMetadataFactory::hasMetadataFor in Plug 7

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

lib/Symfony/validator/Symfony/Component/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;
}