AttributeMetadataInterface.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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;
  11. /**
  12. * Stores metadata needed for serializing and deserializing attributes.
  13. *
  14. * Primarily, the metadata stores serialization groups.
  15. *
  16. * @internal
  17. *
  18. * @author Kévin Dunglas <dunglas@gmail.com>
  19. */
  20. interface AttributeMetadataInterface
  21. {
  22. /**
  23. * Gets the attribute name.
  24. */
  25. public function getName(): string;
  26. /**
  27. * Adds this attribute to the given group.
  28. */
  29. public function addGroup(string $group);
  30. /**
  31. * Gets groups of this attribute.
  32. *
  33. * @return string[]
  34. */
  35. public function getGroups(): array;
  36. /**
  37. * Sets the serialization max depth for this attribute.
  38. */
  39. public function setMaxDepth(?int $maxDepth);
  40. /**
  41. * Gets the serialization max depth for this attribute.
  42. *
  43. * @return int|null
  44. */
  45. public function getMaxDepth();
  46. /**
  47. * Sets the serialization name for this attribute.
  48. */
  49. public function setSerializedName(string $serializedName = null);
  50. /**
  51. * Gets the serialization name for this attribute.
  52. */
  53. public function getSerializedName(): ?string;
  54. /**
  55. * Sets if this attribute must be ignored or not.
  56. */
  57. public function setIgnore(bool $ignore);
  58. /**
  59. * Gets if this attribute is ignored or not.
  60. */
  61. public function isIgnored(): bool;
  62. /**
  63. * Merges an {@see AttributeMetadataInterface} with in the current one.
  64. */
  65. public function merge(self $attributeMetadata);
  66. }