Passed
Pull Request — 1.x (#9)
by Marko
02:32
created

AddChildReader::getChildren()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Reader;
6
7
use KunicMarko\SonataAnnotationBundle\Annotation\AddChild;
8
9
/**
10
 * @author Marko Kunic <[email protected]>
11
 */
12
final class AddChildReader
13
{
14
    use AnnotationReaderTrait;
15
16
    public function getChildren(\ReflectionClass $class): array
17
    {
18
        $children = [];
19
20
        foreach ($this->getClassAnnotations($class) as $annotation) {
21
            if (!$annotation instanceof AddChild) {
22
                continue;
23
            }
24
25
            $children[$annotation->getClass()] = $annotation->getField();
26
        }
27
28
        return $children;
29
    }
30
}
31