Completed
Push — master ( 583849...e66a3e )
by Paweł
20s
created

Lesson::setEmbedType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Entity;
4
5
use App\Model\AttachmentInterface;
6
use App\Model\LessonInterface;
7
use App\Model\PersistableAwareTrait;
8
use App\Model\SortableAwareTrait;
9
use App\Model\TimestampableAwareTrait;
10
use DateTime;
11
use Doctrine\Common\Collections\ArrayCollection;
12
use Doctrine\Common\Collections\Collection;
13
use Symfony\Component\HttpFoundation\File\File;
14
15
class Lesson implements LessonInterface
16
{
17
    use TimestampableAwareTrait, SortableAwareTrait, PersistableAwareTrait;
18
19
    private $title;
20
21
    private $description;
22
23
    private $embedType = LessonInterface::EMBED_TYPE_CODE;
24
25
    private $embedCode;
26
27
    private $module;
28
29
    private $coverImageName;
30
31
    private $durationInMinutes = 0;
32
33
    private $attachments;
34
35
    private $coverImageFile;
36
37
    public function __construct()
38
    {
39
        $this->attachments = new ArrayCollection();
40
    }
41
42
    public function getTitle(): ?string
43
    {
44
        return $this->title;
45
    }
46
47
    public function setTitle(string $title): void
48
    {
49
        $this->title = $title;
50
    }
51
52
    public function getDescription(): ?string
53
    {
54
        return $this->description;
55
    }
56
57
    public function setDescription(string $description): void
58
    {
59
        $this->description = $description;
60
    }
61
62
    public function setEmbedType(string $embedType): void
63
    {
64
        $this->embedType = $embedType;
65
    }
66
67
    public function getEmbedType(): string
68
    {
69
        return $this->embedType;
70
    }
71
72
    public function getEmbedCode(): ?string
73
    {
74
        return $this->embedCode;
75
    }
76
77
    public function setEmbedCode(string $embedCode): void
78
    {
79
        $this->embedCode = $embedCode;
80
    }
81
82
    public function getModule(): ?Module
83
    {
84
        return $this->module;
85
    }
86
87
    public function setModule(?Module $module): void
88
    {
89
        $this->module = $module;
90
    }
91
92
    public function getCoverImageName(): ?string
93
    {
94
        return $this->coverImageName;
95
    }
96
97
    public function setCoverImageName(?string $coverImageName): void
98
    {
99
        $this->coverImageName = $coverImageName;
100
    }
101
102
    public function setCoverImageFile(?File $coverImageFile = null): void
103
    {
104
        $this->coverImageFile = $coverImageFile;
105
        $this->updated = new DateTime();
106
    }
107
108
    public function getCoverImageFile(): ?File
109
    {
110
        return $this->coverImageFile;
111
    }
112
113
    public function getDurationInMinutes(): int
114
    {
115
        return $this->durationInMinutes;
116
    }
117
118
    public function setDurationInMinutes(int $durationInMinutes): void
119
    {
120
        $this->durationInMinutes = $durationInMinutes;
121
    }
122
123
    public function getAttachments(): Collection
124
    {
125
        return $this->attachments;
126
    }
127
128
    public function addAttachment(AttachmentInterface $attachment): void
129
    {
130
        if (!$this->attachments->contains($attachment)) {
131
            $this->attachments->add($attachment);
132
        }
133
    }
134
135
    public function removeAttachment(AttachmentInterface $attachment): void
136
    {
137
        if ($this->attachments->contains($attachment)) {
138
            $this->attachments->removeElement($attachment);
139
        }
140
    }
141
142
    public function __toString()
143
    {
144
        return (string) $this->getTitle();
145
    }
146
}
147