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

Access::getRole()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 0
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 Access implements AnnotationInterface
14
{
15
    /**
16
     * @var string
17
     */
18
    public $role;
19
20
    /**
21
     * @var array
22
     */
23
    public $permissions;
24
25
    public function getRole(): string
26
    {
27
        if ($this->role) {
28
            return $this->role;
29
        }
30
31
        throw new \InvalidArgumentException(
32
            sprintf(
33
                'Argument "role" is mandatory in "%s" annotation.',
34
                self::class
35
            )
36
        );
37
    }
38
}
39