Passed
Push — master ( 719760...59ab2e )
by Angel Fernando Quiroz
18:35
created

getResourceIdentifier()   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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CourseBundle\Entity;
8
9
use Chamilo\CoreBundle\Entity\AbstractResource;
10
use Chamilo\CoreBundle\Entity\ResourceInterface;
11
use Chamilo\CourseBundle\Repository\CStudentPublicationCorrectionRepository;
12
use Doctrine\ORM\Mapping as ORM;
13
use Stringable;
14
use Symfony\Component\Validator\Constraints as Assert;
15
16
#[ORM\Table(name: 'c_student_publication_correction')]
17
#[ORM\Entity(repositoryClass: CStudentPublicationCorrectionRepository::class)]
18
class CStudentPublicationCorrection extends AbstractResource implements ResourceInterface, Stringable
19
{
20
    #[ORM\Column(name: 'id', type: 'integer')]
21
    #[ORM\Id]
22
    #[ORM\GeneratedValue]
23
    protected ?int $id = null;
24
25
    #[Assert\NotBlank]
26
    #[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false)]
27
    protected string $title;
28
29
    public function __toString(): string
30
    {
31
        return $this->title;
32
    }
33
34
    public function getResourceIdentifier(): int
35
    {
36
        return $this->getId();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getId() 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...
37
    }
38
39
    public function getId(): ?int
40
    {
41
        return $this->id;
42
    }
43
44
    public function getResourceName(): string
45
    {
46
        return $this->getTitle();
47
    }
48
49
    public function getTitle(): string
50
    {
51
        return $this->title;
52
    }
53
54
    public function setTitle(string $title): self
55
    {
56
        $this->title = $title;
57
58
        return $this;
59
    }
60
61
    public function setResourceName(string $name): self
62
    {
63
        return $this->setTitle($name);
64
    }
65
}
66