Passed
Pull Request — master (#44)
by Paweł
03:43
created

Course::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Entity;
4
5
use App\Model\CourseInterface;
6
use App\Model\TimeLimitedAwareTrait;
7
use App\Model\TimestampableAwareTrait;
8
use App\Model\VisibilityAwareTrait;
9
use Doctrine\Common\Collections\ArrayCollection;
10
use Doctrine\Common\Collections\Collection;
11
use phpDocumentor\Reflection\Types\Boolean;
12
use Symfony\Component\HttpFoundation\File\File;
13
14
class Course implements CourseInterface
15
{
16
    use TimestampableAwareTrait;
17
    use VisibilityAwareTrait;
18
    use TimeLimitedAwareTrait;
19
20
    private ?int $id = null;
21
22
    private ?string $title = null;
23
24
    private ?string $description = null;
25
26
    private ?string $sku = null;
27
28
    private ?string $coverImageName = null;
29
30
    private ?File $coverImageFile = null;
31
32
    private Collection $authors;
33
34
    private string $type = CourseInterface::COURSE_TYPE_STANDARD;
35
36
    private ?string $purchaseUrl = null;
37
38
    private ?CourseInterface $parent = null;
39
40
    public function __construct()
41
    {
42
        $this->setVisible(true);
43
        $this->setAuthors(new ArrayCollection());
44
    }
45
46
    public function getId(): ?int
47
    {
48
        return $this->id;
49
    }
50
51
    public function getTitle(): ?string
52
    {
53
        return $this->title;
54
    }
55
56
    public function setTitle(string $title): void
57
    {
58
        $this->title = $title;
59
    }
60
61
    public function getDescription(): ?string
62
    {
63
        return $this->description;
64
    }
65
66
    public function setDescription(string $description): void
67
    {
68
        $this->description = $description;
69
    }
70
71
    public function getSku(): ?string
72
    {
73
        return $this->sku;
74
    }
75
76
    public function setSku(string $sku): void
77
    {
78
        $this->sku = $sku;
79
    }
80
81
    public function getCoverImageName(): ?string
82
    {
83
        return $this->coverImageName;
84
    }
85
86
    public function setCoverImageName(?string $coverImageName): void
87
    {
88
        $this->coverImageName = $coverImageName;
89
    }
90
91
    public function setCoverImageFile(?File $coverImageFile = null): void
92
    {
93
        $this->coverImageFile = $coverImageFile;
94
        $this->updated = new \DateTime();
95
    }
96
97
    public function getCoverImageFile(): ?File
98
    {
99
        return $this->coverImageFile;
100
    }
101
102
    public function getAuthors(): Collection
103
    {
104
        return $this->authors;
105
    }
106
107
    public function setAuthors(Collection $authors): void
108
    {
109
        $this->authors = $authors;
110
    }
111
112
    public function getType(): string
113
    {
114
        return $this->type;
115
    }
116
117
    public function setType(string $type): void
118
    {
119
        $this->type = $type;
120
    }
121
122
    public function getPurchaseUrl(): ?string
123
    {
124
        return $this->purchaseUrl;
125
    }
126
127
    public function setPurchaseUrl(?string $purchaseUrl): void
128
    {
129
        $this->purchaseUrl = $purchaseUrl;
130
    }
131
132
    public function getParent(): ?CourseInterface
133
    {
134
        return $this->parent;
135
    }
136
137
    public function setParent(?CourseInterface $parent): void
138
    {
139
        $this->parent = $parent;
140
    }
141
142
    public function __toString()
143
    {
144
        return (string) ($this->title ?? 'New course');
145
    }
146
}
147