Completed
Pull Request — develop (#27)
by Chris
13:09
created

AttributeMetadatas::generateMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Chrisyue\PhpM3u8\Model\Mapping;
4
5
use Chrisyue\PhpM3u8\Model\Annotation\Attribute;
6
use Doctrine\Common\Annotations\AnnotationReader;
7
use Doctrine\Common\Annotations\AnnotationRegistry;
8
9
class AttributeMetadatas extends AbstractMetadatas
10
{
11
    public function __construct($class)
12
    {
13
        AnnotationRegistry::registerFile((new \ReflectionClass(Attribute::class))->getFileName());
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...egistry::registerFile() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
14
        $this->annotationReader = new AnnotationReader();
15
16
        $this->load($class);
17
    }
18
19
    protected function generateMetadata(\ReflectionProperty $property, $annot)
20
    {
21
        $metadata = new AttributeMetadata($property, $annot->name, $annot->type);
22
23
        $this->metadatas[$metadata->getName()] = $metadata;
24
    }
25
}
26