Passed
Pull Request — master (#5651)
by Yannick
07:40
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: 'permissions')]
17
class Permission implements Stringable
18
{
19
    #[ORM\Id]
20
    #[ORM\GeneratedValue(strategy: 'AUTO')]
21
    #[ORM\Column(type: 'integer')]
22
    private ?int $id = null;
23
24
    #[Assert\NotBlank]
25
    #[ORM\Column(type: 'string', length: 255)]
26
    private string $title;
27
28
    #[Assert\NotBlank]
29
    #[ORM\Column(type: 'string', length: 255, unique: true)]
30
    private string $slug;
31
32
    #[ORM\Column(type: 'text', nullable: true)]
33
    private ?string $description = null;
34
35
    public function getId(): ?int
36
    {
37
        return $this->id;
38
    }
39
40
    public function getTitle(): string
41
    {
42
        return $this->title;
43
    }
44
45
    public function setTitle(string $title): self
46
    {
47
        $this->title = $title;
48
        return $this;
49
    }
50
51
    public function getSlug(): string
52
    {
53
        return $this->slug;
54
    }
55
56
    public function setSlug(string $slug): self
57
    {
58
        $this->slug = $slug;
59
        return $this;
60
    }
61
62
    public function getDescription(): ?string
63
    {
64
        return $this->description;
65
    }
66
67
    public function setDescription(?string $description): self
68
    {
69
        $this->description = $description;
70
        return $this;
71
    }
72
73
    public function __toString(): string
74
    {
75
        return $this->title;
76
    }
77
}
78