Completed
Push — 1.x ( aadfa3...ac39bc )
by Marko
02:25
created

AddRoute   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getName() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Annotation;
6
7
/**
8
 * @Annotation
9
 * @Target("CLASS")
10
 *
11
 * @author Marko Kunic <[email protected]>
12
 */
13
class AddRoute implements AnnotationInterface
14
{
15
    public const ID_PARAMETER = '{id}';
16
17
    /**
18
     * @var string
19
     */
20
    public $name;
21
22
    /**
23
     * @var string
24
     */
25
    public $path;
26
27
    public function getName(): string
28
    {
29
        if ($this->name) {
30
            return $this->name;
31
        }
32
33
        throw new \InvalidArgumentException(
34
            sprintf(
35
                'Argument "name" is mandatory in "%s" annotation.',
36
                self::class
37
            )
38
        );
39
    }
40
}
41