Passed
Pull Request — 1.x (#9)
by Marko
02:32
created

AnnotationReaderTrait::getPropertyAnnotation()   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 2
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)
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 getPropertyAnnotations(\ReflectionProperty $property): array
33
    {
34
        return $this->annotationReader->getPropertyAnnotations($property);
35
    }
36
37
    protected function getMethodAnnotation(\ReflectionMethod $method, string $annotation)
38
    {
39
        return $this->annotationReader->getMethodAnnotation($method, $annotation);
40
    }
41
}
42