Passed
Pull Request — 1.x (#35)
by Marko
05:54
created

Group   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 32
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
final class Group implements AnnotationInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    public $name;
19
20
    /**
21
     * @var string
22
     */
23
    public $tab;
24
25
    /**
26
     * @var array
27
     */
28
    public $options = [];
29
30
    /**
31
     * @var integer
32
     */
33
    public $position;
34
35
    public function getName(): string
36
    {
37
        if ($this->name) {
38
            return $this->name;
39
        }
40
41
        throw new \InvalidArgumentException(
42
            sprintf(
43
                'Argument "name" is mandatory in "%s" annotation.',
44
                self::class
45
            )
46
        );
47
    }
48
}
49