AnnotationReaderTrait::getClassAnnotation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 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
 * @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