Passed
Push — master ( 727abb...ceefce )
by Yannick
07:55 queued 14s
created

ResourceFormat::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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 Doctrine\Common\Collections\ArrayCollection;
10
use Doctrine\Common\Collections\Collection;
11
use Doctrine\ORM\Mapping as ORM;
12
use Gedmo\Timestampable\Traits\TimestampableEntity;
13
use Symfony\Component\Validator\Constraints as Assert;
14
15
#[ORM\Entity]
16
#[ORM\Table(name: 'resource_format')]
17
class ResourceFormat
18
{
19
    use TimestampableEntity;
20
21
    #[ORM\Id]
22
    #[ORM\Column(type: 'integer')]
23
    #[ORM\GeneratedValue]
24
    protected ?int $id = null;
25
26
    #[ORM\Column]
27
    #[Assert\NotBlank]
28
    protected string $title;
29
30
    /**
31
     * @var Collection<int, ResourceNode>
32
     */
33
    #[ORM\OneToMany(targetEntity: ResourceNode::class, mappedBy: 'resourceFormat', cascade: ['persist', 'remove'])]
34
    protected Collection $resourceNodes;
35
36
    public function __construct()
37
    {
38
        $this->resourceNodes = new ArrayCollection();
39
    }
40
41
    public function __toString(): string
42
    {
43
        return $this->title;
44
    }
45
46
    public function getId(): int
47
    {
48
        return $this->id;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->id could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
49
    }
50
51
    public function getTitle(): string
52
    {
53
        return $this->title;
54
    }
55
56
    public function setTitle(string $title): self
57
    {
58
        $this->title = $title;
59
60
        return $this;
61
    }
62
63
    /**
64
     * @return Collection<int, ResourceNode>
65
     */
66
    public function getResourceNodes(): Collection
67
    {
68
        return $this->resourceNodes;
69
    }
70
71
    public function setResourceNodes(Collection $resourceNodes): self
72
    {
73
        $this->resourceNodes = $resourceNodes;
74
75
        return $this;
76
    }
77
}
78