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

AttributeMetadatas   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A generateMetadata() 0 6 1
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