ClassMetadataFactoryInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Serializer\Mapping\Factory;
  11. use Symfony\Component\Serializer\Exception\InvalidArgumentException;
  12. use Symfony\Component\Serializer\Mapping\ClassMetadataInterface;
  13. /**
  14. * Returns a {@see ClassMetadataInterface}.
  15. *
  16. * @author Kévin Dunglas <dunglas@gmail.com>
  17. */
  18. interface ClassMetadataFactoryInterface
  19. {
  20. /**
  21. * If the method was called with the same class name (or an object of that
  22. * class) before, the same metadata instance is returned.
  23. *
  24. * If the factory was configured with a cache, this method will first look
  25. * for an existing metadata instance in the cache. If an existing instance
  26. * is found, it will be returned without further ado.
  27. *
  28. * Otherwise, a new metadata instance is created. If the factory was
  29. * configured with a loader, the metadata is passed to the
  30. * {@link \Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::loadClassMetadata()} method for further
  31. * configuration. At last, the new object is returned.
  32. *
  33. * @param string|object $value
  34. *
  35. * @return ClassMetadataInterface
  36. *
  37. * @throws InvalidArgumentException
  38. */
  39. public function getMetadataFor($value);
  40. /**
  41. * Checks if class has metadata.
  42. *
  43. * @param mixed $value
  44. *
  45. * @return bool
  46. */
  47. public function hasMetadataFor($value);
  48. }