Lesson   A
last analyzed

Complexity

Total Complexity 25

Size/Duplication

Total Lines 144
Duplicated Lines 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 25
eloc 40
c 3
b 1
f 1
dl 0
loc 144
rs 10

23 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getDescription() 0 3 1
A setBlocked() 0 3 1
A removeAttachment() 0 4 2
A setDurationInMinutes() 0 3 1
A setEmbedCode() 0 3 1
A __toString() 0 3 1
A getCoverImageFile() 0 3 1
A getEmbedCode() 0 3 1
A getTitle() 0 3 1
A setTitle() 0 3 1
A setDescription() 0 3 1
A getModule() 0 3 1
A addAttachment() 0 4 2
A setModule() 0 3 1
A setEmbedType() 0 3 1
A getCoverImageName() 0 3 1
A isBlocked() 0 3 1
A setCoverImageName() 0 3 1
A getAttachments() 0 3 1
A getDurationInMinutes() 0 3 1
A setCoverImageFile() 0 4 1
A getEmbedType() 0 3 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;
18
    use SortableAwareTrait;
19
    use PersistableAwareTrait;
20
21
    private ?string $title = null;
22
23
    private ?string $description = null;
24
25
    private string $embedType = LessonInterface::EMBED_TYPE_CODE;
26
27
    private ?string $embedCode = null;
28
29
    private ?Module $module = null;
30
31
    private ?string $coverImageName = null;
32
33
    private int $durationInMinutes = 0;
34
35
    private Collection $attachments;
36
37
    private ?File $coverImageFile = null;
38
39
    private bool $blocked = false;
40
41
    public function __construct()
42
    {
43
        $this->attachments = new ArrayCollection();
44
    }
45
46
    public function getTitle(): ?string
47
    {
48
        return $this->title;
49
    }
50
51
    public function setTitle(string $title): void
52
    {
53
        $this->title = $title;
54
    }
55
56
    public function getDescription(): ?string
57
    {
58
        return $this->description;
59
    }
60
61
    public function setDescription(string $description): void
62
    {
63
        $this->description = $description;
64
    }
65
66
    public function setEmbedType(string $embedType): void
67
    {
68
        $this->embedType = $embedType;
69
    }
70
71
    public function getEmbedType(): string
72
    {
73
        return $this->embedType;
74
    }
75
76
    public function getEmbedCode(): ?string
77
    {
78
        return $this->embedCode;
79
    }
80
81
    public function setEmbedCode(string $embedCode): void
82
    {
83
        $this->embedCode = $embedCode;
84
    }
85
86
    public function getModule(): ?Module
87
    {
88
        return $this->module;
89
    }
90
91
    public function setModule(?Module $module): void
92
    {
93
        $this->module = $module;
94
    }
95
96
    public function getCoverImageName(): ?string
97
    {
98
        return $this->coverImageName;
99
    }
100
101
    public function setCoverImageName(?string $coverImageName): void
102
    {
103
        $this->coverImageName = $coverImageName;
104
    }
105
106
    public function setCoverImageFile(?File $coverImageFile = null): void
107
    {
108
        $this->coverImageFile = $coverImageFile;
109
        $this->updated = new DateTime();
110
    }
111
112
    public function getCoverImageFile(): ?File
113
    {
114
        return $this->coverImageFile;
115
    }
116
117
    public function getDurationInMinutes(): int
118
    {
119
        return $this->durationInMinutes;
120
    }
121
122
    public function setDurationInMinutes(int $durationInMinutes): void
123
    {
124
        $this->durationInMinutes = $durationInMinutes;
125
    }
126
127
    public function getAttachments(): Collection
128
    {
129
        return $this->attachments;
130
    }
131
132
    public function addAttachment(AttachmentInterface $attachment): void
133
    {
134
        if (!$this->attachments->contains($attachment)) {
135
            $this->attachments->add($attachment);
136
        }
137
    }
138
139
    public function removeAttachment(AttachmentInterface $attachment): void
140
    {
141
        if ($this->attachments->contains($attachment)) {
142
            $this->attachments->removeElement($attachment);
143
        }
144
    }
145
146
    public function isBlocked(): bool
147
    {
148
        return $this->blocked;
149
    }
150
151
    public function setBlocked(bool $blocked): void
152
    {
153
        $this->blocked = $blocked;
154
    }
155
156
    public function __toString()
157
    {
158
        return (string) $this->getTitle();
159
    }
160
}
161