Passed
Push — develop ( 355f63...51016a )
by Mathieu
02:23
created

RemoveRoute   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
dl 0
loc 25
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Neimheadh\SonataAnnotationBundle\Annotation\Sonata;
6
7
use Attribute;
8
use Neimheadh\SonataAnnotationBundle\Annotation\AbstractAnnotation;
9
use Neimheadh\SonataAnnotationBundle\Annotation\RouteAnnotationInterface;
10
use ReflectionException;
11
12
/**
13
 * Remove route annotation.
14
 *
15
 * Allows you to remove a default route from your admin.
16
 *
17
 * @Annotation
18
 * @Target("CLASS")
19
 *
20
 * @author Marko Kunic <[email protected]>
21
 * @author Mathieu Wambre <[email protected]>
22
 */
23
#[Attribute(Attribute::TARGET_CLASS)]
24
final class RemoveRoute extends AbstractAnnotation implements
25
    RouteAnnotationInterface
26
{
27
28
    /**
29
     * Removed route name.
30
     *
31
     * @var string|null
32
     */
33
    public ?string $name = null;
34
35
    /**
36
     * @param string|array|null $name Removed route name or annotation
37
     *                                parameters.
38
     *
39
     * @throws ReflectionException
40
     */
41
    public function __construct(
42
        $name = null
43
    ) {
44
        if (is_array($name)) {
45
            $this->initAnnotation($name);
46
        } else {
47
            $this->name = $name;
48
        }
49
    }
50
51
}
52