| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\Serializer\Mapping\Factory; |
| 13 |
|
| 14 |
use Symfony\Component\Serializer\Exception\InvalidArgumentException; |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
> |
| 22 |
|
| 23 |
trait ClassResolverTrait |
| 24 |
{ |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
private function getClass(object|string $value): string |
| 31 |
{ |
| 32 |
if (\is_string($value)) { |
| 33 |
if (!class_exists($value) && !interface_exists($value, false)) { |
| 34 |
throw new InvalidArgumentException(\sprintf('The class or interface "%s" does not exist.', $value)); |
| 35 |
} |
| 36 |
|
| 37 |
return ltrim($value, '\\'); |
| 38 |
} |
| 39 |
|
| 40 |
return $value::class; |
| 41 |
} |
| 42 |
} |