Passed
Pull Request — master (#5651)
by Yannick
09:53
created

Permission::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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