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

ParameterAnnotationListener::accept()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 3
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
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