AnnotationReaderTrait   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
eloc 7
c 1
b 0
f 1
dl 0
loc 27
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethodAnnotation() 0 3 1
A getPropertyAnnotations() 0 3 1
A __construct() 0 3 1
A getClassAnnotations() 0 3 1
A getClassAnnotation() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Reader;
6
7
use Doctrine\Common\Annotations\Reader;
8
use KunicMarko\SonataAnnotationBundle\Annotation\AnnotationInterface;
9
10
/**
11
 * @internal
12
 *
13
 * @author Marko Kunic <[email protected]>
14
 */
15
trait AnnotationReaderTrait
16
{
17
    private $annotationReader;
18
19
    public function __construct(Reader $annotationReader)
20
    {
21
        $this->annotationReader = $annotationReader;
22
    }
23
24
    protected function getClassAnnotation(\ReflectionClass $class, string $annotation)
25
    {
26
        return $this->annotationReader->getClassAnnotation($class, $annotation);
27
    }
28
29
    protected function getClassAnnotations(\ReflectionClass $class): array
30
    {
31
        return $this->annotationReader->getClassAnnotations($class);
32
    }
33
34
    protected function getPropertyAnnotations(\ReflectionProperty $property): array
35
    {
36
        return $this->annotationReader->getPropertyAnnotations($property);
37
    }
38
39
    protected function getMethodAnnotation(\ReflectionMethod $method, string $annotation)
40
    {
41
        return $this->annotationReader->getMethodAnnotation($method, $annotation);
42
    }
43
}
44