AbstractActionReader::getActions()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 10
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Reader;
6
7
use KunicMarko\SonataAnnotationBundle\Annotation\AbstractAction;
8
9
/**
10
 * @author Marko Kunic <[email protected]>
11
 */
12
abstract class AbstractActionReader
13
{
14
    use AnnotationReaderTrait;
15
16
    public function getActions(\ReflectionClass $class, array $actions): array
17
    {
18
        foreach ($this->getClassAnnotations($class) as $annotation) {
19
            if ($this->isSupported($annotation)) {
20
                /** @var AbstractAction $annotation */
21
                $actions[random_int(-99999, 99999)]['template'] = $annotation->getTemplate();
22
            }
23
        }
24
25
        return $actions;
26
    }
27
28
    abstract protected function isSupported($annotation): bool;
29
}
30