You are here

class AttributeMetadata in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/serializer/Mapping/AttributeMetadata.php \Symfony\Component\Serializer\Mapping\AttributeMetadata

@author Kévin Dunglas <dunglas@gmail.com>

Hierarchy

Expanded class hierarchy of AttributeMetadata

5 files declare their use of AttributeMetadata
AnnotationLoader.php in vendor/symfony/serializer/Mapping/Loader/AnnotationLoader.php
AttributeMetadataTest.php in vendor/symfony/serializer/Tests/Mapping/AttributeMetadataTest.php
TestClassMetadataFactory.php in vendor/symfony/serializer/Tests/Mapping/TestClassMetadataFactory.php
XmlFileLoader.php in vendor/symfony/serializer/Mapping/Loader/XmlFileLoader.php
YamlFileLoader.php in vendor/symfony/serializer/Mapping/Loader/YamlFileLoader.php

File

vendor/symfony/serializer/Mapping/AttributeMetadata.php, line 19

Namespace

Symfony\Component\Serializer\Mapping
View source
class AttributeMetadata implements AttributeMetadataInterface {

  /**
   * @var string
   *
   * @internal This property is public in order to reduce the size of the
   *           class' serialized representation. Do not access it. Use
   *           {@link getName()} instead.
   */
  public $name;

  /**
   * @var array
   *
   * @internal This property is public in order to reduce the size of the
   *           class' serialized representation. Do not access it. Use
   *           {@link getGroups()} instead.
   */
  public $groups = array();

  /**
   * Constructs a metadata for the given attribute.
   *
   * @param string $name
   */
  public function __construct($name) {
    $this->name = $name;
  }

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return $this->name;
  }

  /**
   * {@inheritdoc}
   */
  public function addGroup($group) {
    if (!in_array($group, $this->groups)) {
      $this->groups[] = $group;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getGroups() {
    return $this->groups;
  }

  /**
   * {@inheritdoc}
   */
  public function merge(AttributeMetadataInterface $attributeMetadata) {
    foreach ($attributeMetadata
      ->getGroups() as $group) {
      $this
        ->addGroup($group);
    }
  }

  /**
   * Returns the names of the properties that should be serialized.
   *
   * @return string[]
   */
  public function __sleep() {
    return array(
      'name',
      'groups',
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AttributeMetadata::$groups public property @internal This property is public in order to reduce the size of the class' serialized representation. Do not access it. Use {@link getGroups()} instead.
AttributeMetadata::$name public property @internal This property is public in order to reduce the size of the class' serialized representation. Do not access it. Use {@link getName()} instead.
AttributeMetadata::addGroup public function Adds this attribute to the given group. Overrides AttributeMetadataInterface::addGroup
AttributeMetadata::getGroups public function Gets groups of this attribute. Overrides AttributeMetadataInterface::getGroups
AttributeMetadata::getName public function Gets the attribute name. Overrides AttributeMetadataInterface::getName
AttributeMetadata::merge public function Merges an { Overrides AttributeMetadataInterface::merge
AttributeMetadata::__construct public function Constructs a metadata for the given attribute.
AttributeMetadata::__sleep public function Returns the names of the properties that should be serialized.