Passed
Push — master ( 26f9dc...b66765 )
by Marko
02:57
created

ShowReader::findProperties()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
rs 9.4285
cc 3
eloc 5
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Reader;
6
7
use KunicMarko\SonataAnnotationBundle\Annotation\ShowField;
8
9
/**
10
 * @author Marko Kunic <[email protected]>
11
 */
12
class ShowReader extends AbstractReader
13
{
14
    protected function findProperties(\ReflectionClass $class): array
15
    {
16
        $fields = parent::findProperties($class);
17
18
        foreach ($class->getMethods() as $method) {
19
            if ($annotation = $this->getMethodAnnotation($method, $this->getAnnotation())) {
20
                $fields[$method->getName()] = $annotation;
21
            }
22
        }
23
24
        return $fields;
25
    }
26
27
    protected function getAnnotation(): string
28
    {
29
        return ShowField::class;
30
    }
31
}
32