function ClassResolverTrait::getClass
Gets a class name for a given class or instance.
Throws
InvalidArgumentException If the class does not exist
2 calls to ClassResolverTrait::getClass()
- CacheClassMetadataFactory::getMetadataFor in vendor/
symfony/ serializer/ Mapping/ Factory/ CacheClassMetadataFactory.php - If the method was called with the same class name (or an object of that class) before, the same metadata instance is returned.
- ClassMetadataFactory::getMetadataFor in vendor/
symfony/ serializer/ Mapping/ Factory/ ClassMetadataFactory.php - If the method was called with the same class name (or an object of that class) before, the same metadata instance is returned.
File
-
vendor/
symfony/ serializer/ Mapping/ Factory/ ClassResolverTrait.php, line 30
Class
- ClassResolverTrait
- Resolves a class name.
Namespace
Symfony\Component\Serializer\Mapping\FactoryCode
private function getClass(object|string $value) : string {
if (\is_string($value)) {
if (!class_exists($value) && !interface_exists($value, false)) {
throw new InvalidArgumentException(\sprintf('The class or interface "%s" does not exist.', $value));
}
return ltrim($value, '\\');
}
return $value::class;
}