Role::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Kunstmaan\AdminBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
7
use Symfony\Component\Security\Core\Role\Role as BaseRole;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * Role Entity
12
 *
13
 * @ORM\Entity
14
 * @ORM\Table( name="kuma_roles" )
15
 * @UniqueEntity("role")
16
 */
17
class Role extends BaseRole
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Component\Security\Core\Role\Role has been deprecated with message: since Symfony 4.3, to be removed in 5.0. Use strings as roles instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
18
{
19
    /**
20
     * @ORM\Id
21
     * @ORM\Column(type="integer", name="id")
22
     * @ORM\GeneratedValue(strategy="AUTO")
23
     */
24
    protected $id;
25
26
    /**
27
     * @Assert\NotBlank()
28
     * @ORM\Column(type="string", name="role", unique=true, length=70)
29
     */
30
    protected $role;
31
32
    /**
33
     * Populate the role field
34
     *
35
     * @param string $role
36
     */
37 5
    public function __construct($role)
38
    {
39 5
        $this->role = $role;
40 5
    }
41
42
    /**
43
     * Return the role field.
44
     *
45
     * @return string
46
     */
47 3
    public function getRole()
48
    {
49 3
        return $this->role;
50
    }
51
52
    /**
53
     * Return the string representation of the role entity.
54
     *
55
     * @return string
56
     */
57 1
    public function __toString(): string
58
    {
59 1
        return (string) $this->role;
60
    }
61
62
    /**
63
     * Get id
64
     *
65
     * @return int
66
     */
67 1
    public function getId()
68
    {
69 1
        return $this->id;
70
    }
71
72
    /**
73
     * Modify the role field.
74
     *
75
     * @param string $role ROLE_FOO etc
76
     *
77
     * @return RoleInterface
0 ignored issues
show
Documentation introduced by
Should the return type not be Role?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
78
     */
79 1
    public function setRole($role)
80
    {
81 1
        $this->role = $role;
82
83 1
        return $this;
84
    }
85
}
86