CChatConversation::setTitle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
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\CourseBundle\Entity;
8
9
use Chamilo\CoreBundle\Entity\AbstractResource;
10
use Chamilo\CoreBundle\Entity\ResourceInterface;
11
use Chamilo\CourseBundle\Repository\CChatConversationRepository;
12
use Doctrine\ORM\Mapping as ORM;
13
use Stringable;
14
15
/**
16
 * CChatConversation.
17
 */
18
#[ORM\Table(name: 'c_chat_conversation')]
19
#[ORM\Entity(repositoryClass: CChatConversationRepository::class)]
20
class CChatConversation extends AbstractResource implements ResourceInterface, Stringable
21
{
22
    #[ORM\Column(name: 'id', type: 'integer')]
23
    #[ORM\Id]
24
    #[ORM\GeneratedValue]
25
    protected ?int $id = null;
26
27
    #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: true)]
28
    protected ?string $title = null;
29
30
    public function __toString(): string
31
    {
32
        return $this->getTitle();
33
    }
34
35
    public function getId(): int
36
    {
37
        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...
38
    }
39
40
    public function getTitle(): string
41
    {
42
        return $this->title;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->title could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
43
    }
44
45
    public function setTitle(string $title): self
46
    {
47
        $this->title = $title;
48
49
        return $this;
50
    }
51
52
    /**
53
     * Resource identifier.
54
     */
55
    public function getResourceIdentifier(): int
56
    {
57
        return $this->getId();
58
    }
59
60
    public function getResourceName(): string
61
    {
62
        return $this->getTitle();
63
    }
64
65
    public function setResourceName(string $name): self
66
    {
67
        return $this->setTitle($name);
68
    }
69
}
70