Passed
Push — feature/initial-implementation ( fae671...591f29 )
by Fike
02:37
created

DisableInheritanceAnnotationListener::accept()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 3
nc 2
nop 3
1
<?php
2
3
namespace AmaTeam\ElasticSearch\Entity\Annotation\Listener;
4
5
use AmaTeam\ElasticSearch\API\Annotation\DisableInheritance;
6
use AmaTeam\ElasticSearch\API\Entity\Descriptor;
7
use AmaTeam\ElasticSearch\Entity\Annotation\StructureAnnotationListenerInterface;
8
use ReflectionClass;
9
10
class DisableInheritanceAnnotationListener implements StructureAnnotationListenerInterface
11
{
12
    public function accept(ReflectionClass $reflection, Descriptor $descriptor, $annotation): void
13
    {
14
        if (!($annotation instanceof DisableInheritance)) {
15
            return;
16
        }
17
        $descriptor->setParentNames([]);
18
    }
19
}
20