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

DisableInheritanceAnnotationListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A accept() 0 6 2
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