Passed
Push — feature/initial-implementation ( f3915b...fbd338 )
by Fike
02:22
created

ParameterAnnotationListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A accept() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AmaTeam\ElasticSearch\Entity\Annotation\Listener\Indexing;
6
7
use AmaTeam\ElasticSearch\API\Annotation\Indexing\Infrastructure\OptionAnnotationInterface;
8
use AmaTeam\ElasticSearch\Entity\Annotation\ClassAnnotationListenerInterface;
9
use AmaTeam\ElasticSearch\Entity\Entity;
10
use ReflectionClass;
11
12
class ParameterAnnotationListener implements ClassAnnotationListenerInterface
13
{
14
    public function accept(ReflectionClass $class, Entity $entity, $annotation): void
15
    {
16
        if (!($annotation instanceof OptionAnnotationInterface)) {
17
            return;
18
        }
19
        $entity->getIndexing()->setOption($annotation->getParameter(), $annotation->getValue());
20
    }
21
}
22