Completed
Push — master ( d62d29...27939e )
by Marko
02:28
created

AbstractActionReader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getActions() 0 11 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Reader;
6
7
/**
8
 * @author Marko Kunic <[email protected]>
9
 */
10
abstract class AbstractActionReader
11
{
12
    use AnnotationReaderTrait;
13
14
    public function getActions(\ReflectionClass $class, array $actions): array
15
    {
16
        foreach ($this->getClassAnnotations($class) as $annotation) {
17
            if (!$this->isSupported($annotation)) {
18
                continue;
19
            }
20
21
            $actions[random_int(-99999, 99999)]['template'] = $annotation->template;
22
        }
23
24
        return $actions;
25
    }
26
27
    abstract protected function isSupported($annotation): bool;
28
}
29