RouteReader   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 11
c 1
b 0
f 0
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getRoutes() 0 17 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Reader;
6
7
use KunicMarko\SonataAnnotationBundle\Annotation\AddRoute;
8
use KunicMarko\SonataAnnotationBundle\Annotation\RemoveRoute;
9
10
/**
11
 * @author Marko Kunic <[email protected]>
12
 */
13
final class RouteReader
14
{
15
    use AnnotationReaderTrait;
16
17
    public function getRoutes(\ReflectionClass $class): array
18
    {
19
        $addRoutes = [];
20
        $removeRoutes = [];
21
22
        foreach ($this->getClassAnnotations($class) as $annotation) {
23
            if ($annotation instanceof AddRoute) {
24
                $addRoutes[$annotation->getName()] = $annotation;
25
                continue;
26
            }
27
28
            if ($annotation instanceof RemoveRoute) {
29
                $removeRoutes[$annotation->getName()] = $annotation;
30
            }
31
        }
32
33
        return [$addRoutes, $removeRoutes];
34
    }
35
}
36