Passed
Push — master ( 18e8c0...4526fc )
by Yannick
14:46 queued 06:37
created

Permission   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setSlug() 0 4 1
A getTitle() 0 3 1
A setDescription() 0 4 1
A __toString() 0 3 1
A getDescription() 0 3 1
A getId() 0 3 1
A setTitle() 0 4 1
A getSlug() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Chamilo\CoreBundle\Repository\PermissionRepository;
10
use Doctrine\ORM\Mapping as ORM;
11
use Stringable;
12
use Symfony\Component\Validator\Constraints as Assert;
13
14
15
#[ORM\Entity(repositoryClass: PermissionRepository::class)]
16
#[ORM\Table(name: 'permission')]
17
/**
18
 * A Permission defines something a user role can do.
19
 * The permissions a role has is determined by the PermissionRelRole entity.
20
 */
21
class Permission implements Stringable
22
{
23
    #[ORM\Id]
24
    #[ORM\GeneratedValue(strategy: 'AUTO')]
25
    #[ORM\Column(type: 'integer')]
26
    private ?int $id = null;
27
28
    #[Assert\NotBlank]
29
    #[ORM\Column(type: 'string', length: 255)]
30
    private string $title;
31
32
    #[Assert\NotBlank]
33
    #[ORM\Column(type: 'string', length: 255, unique: true)]
34
    private string $slug;
35
36
    #[ORM\Column(type: 'text', nullable: true)]
37
    private ?string $description = null;
38
39
    public function getId(): ?int
40
    {
41
        return $this->id;
42
    }
43
44
    public function getTitle(): string
45
    {
46
        return $this->title;
47
    }
48
49
    public function setTitle(string $title): self
50
    {
51
        $this->title = $title;
52
        return $this;
53
    }
54
55
    public function getSlug(): string
56
    {
57
        return $this->slug;
58
    }
59
60
    public function setSlug(string $slug): self
61
    {
62
        $this->slug = $slug;
63
        return $this;
64
    }
65
66
    public function getDescription(): ?string
67
    {
68
        return $this->description;
69
    }
70
71
    public function setDescription(?string $description): self
72
    {
73
        $this->description = $description;
74
        return $this;
75
    }
76
77
    public function __toString(): string
78
    {
79
        return $this->title;
80
    }
81
}
82