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

ParentAssociationMappingReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getParent() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Reader;
6
7
use KunicMarko\SonataAnnotationBundle\Annotation\ParentAssociationMapping;
8
9
/**
10
 * @author Marko Kunic <[email protected]>
11
 */
12
class ParentAssociationMappingReader
13
{
14
    use AnnotationReaderTrait;
15
16
    public function getParent(\ReflectionClass $class): ?string
17
    {
18
        if ($annotation = $this->getClassAnnotation($class, ParentAssociationMapping::class)) {
19
            return $annotation->parent;
0 ignored issues
show
Bug introduced by
Accessing parent on the interface KunicMarko\SonataAnnotat...ion\AnnotationInterface suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
20
        }
21
22
        return null;
23
    }
24
}
25