class ClassMetadata in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/validator/Mapping/ClassMetadata.php \Symfony\Component\Validator\Mapping\ClassMetadata
 - 8 vendor/symfony/serializer/Mapping/ClassMetadata.php \Symfony\Component\Serializer\Mapping\ClassMetadata
 
Same name and namespace in other branches
- 8.0 vendor/symfony/serializer/Mapping/ClassMetadata.php \Symfony\Component\Serializer\Mapping\ClassMetadata
 
@author Kévin Dunglas <dunglas@gmail.com>
Hierarchy
- class \Symfony\Component\Serializer\Mapping\ClassMetadata implements ClassMetadataInterface
 
Expanded class hierarchy of ClassMetadata
6 files declare their use of ClassMetadata
- AnnotationLoaderTest.php in vendor/
symfony/ serializer/ Tests/ Mapping/ Loader/ AnnotationLoaderTest.php  - ClassMetadataFactory.php in vendor/
symfony/ serializer/ Mapping/ Factory/ ClassMetadataFactory.php  - ClassMetadataTest.php in vendor/
symfony/ serializer/ Tests/ Mapping/ ClassMetadataTest.php  - TestClassMetadataFactory.php in vendor/
symfony/ serializer/ Tests/ Mapping/ TestClassMetadataFactory.php  - XmlFileLoaderTest.php in vendor/
symfony/ serializer/ Tests/ Mapping/ Loader/ XmlFileLoaderTest.php  
File
- vendor/
symfony/ serializer/ Mapping/ ClassMetadata.php, line 19  
Namespace
Symfony\Component\Serializer\MappingView source
class ClassMetadata implements ClassMetadataInterface {
  /**
   * @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 AttributeMetadataInterface[]
   *
   * @internal This property is public in order to reduce the size of the
   *           class' serialized representation. Do not access it. Use
   *           {@link getAttributesMetadata()} instead.
   */
  public $attributesMetadata = array();
  /**
   * @var \ReflectionClass
   */
  private $reflClass;
  /**
   * Constructs a metadata for the given class.
   *
   * @param string $class
   */
  public function __construct($class) {
    $this->name = $class;
  }
  /**
   * {@inheritdoc}
   */
  public function getName() {
    return $this->name;
  }
  /**
   * {@inheritdoc}
   */
  public function addAttributeMetadata(AttributeMetadataInterface $attributeMetadata) {
    $this->attributesMetadata[$attributeMetadata
      ->getName()] = $attributeMetadata;
  }
  /**
   * {@inheritdoc}
   */
  public function getAttributesMetadata() {
    return $this->attributesMetadata;
  }
  /**
   * {@inheritdoc}
   */
  public function merge(ClassMetadataInterface $classMetadata) {
    foreach ($classMetadata
      ->getAttributesMetadata() as $attributeMetadata) {
      if (isset($this->attributesMetadata[$attributeMetadata
        ->getName()])) {
        $this->attributesMetadata[$attributeMetadata
          ->getName()]
          ->merge($attributeMetadata);
      }
      else {
        $this
          ->addAttributeMetadata($attributeMetadata);
      }
    }
  }
  /**
   * {@inheritdoc}
   */
  public function getReflectionClass() {
    if (!$this->reflClass) {
      $this->reflClass = new \ReflectionClass($this
        ->getName());
    }
    return $this->reflClass;
  }
  /**
   * Returns the names of the properties that should be serialized.
   *
   * @return string[]
   */
  public function __sleep() {
    return array(
      'name',
      'attributesMetadata',
    );
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            ClassMetadata:: | 
                  public | property | @internal This property is public in order to reduce the size of the class' serialized representation. Do not access it. Use {@link getAttributesMetadata()} instead. | |
| 
            ClassMetadata:: | 
                  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. | |
| 
            ClassMetadata:: | 
                  private | property | ||
| 
            ClassMetadata:: | 
                  public | function | 
            Adds an {@link AttributeMetadataInterface}. Overrides ClassMetadataInterface:: | 
                  |
| 
            ClassMetadata:: | 
                  public | function | 
            Gets the list of {@link AttributeMetadataInterface}. Overrides ClassMetadataInterface:: | 
                  |
| 
            ClassMetadata:: | 
                  public | function | 
            Returns the name of the backing PHP class. Overrides ClassMetadataInterface:: | 
                  |
| 
            ClassMetadata:: | 
                  public | function | 
            Returns a {@link \ReflectionClass} instance for this class. Overrides ClassMetadataInterface:: | 
                  |
| 
            ClassMetadata:: | 
                  public | function | 
            Merges a {@link ClassMetadataInterface} in the current one. Overrides ClassMetadataInterface:: | 
                  |
| 
            ClassMetadata:: | 
                  public | function | Constructs a metadata for the given class. | |
| 
            ClassMetadata:: | 
                  public | function | Returns the names of the properties that should be serialized. |