Completed
Push — master ( d62d29...27939e )
by Marko
02:28
created

AnnotationReaderTrait::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 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
 * @author Marko Kunic <[email protected]>
12
 */
13
trait AnnotationReaderTrait
14
{
15
    private $annotationReader;
16
17
    public function __construct(Reader $annotationReader)
18
    {
19
        $this->annotationReader = $annotationReader;
20
    }
21
22
    protected function getClassAnnotation(\ReflectionClass $class, string $annotation): ?AnnotationInterface
23
    {
24
        return $this->annotationReader->getClassAnnotation($class, $annotation);
25
    }
26
27
    protected function getClassAnnotations(\ReflectionClass $class): array
28
    {
29
        return $this->annotationReader->getClassAnnotations($class);
30
    }
31
32
    protected function getPropertyAnnotation(\ReflectionProperty $property, string $annotation): ?AnnotationInterface
33
    {
34
        return $this->annotationReader->getPropertyAnnotation($property, $annotation);
35
    }
36
}
37