Passed
Pull Request — master (#38)
by Paweł
03:57
created

Course::getSku()   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 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 Symfony\Component\HttpFoundation\File\File;
12
13
class Course implements CourseInterface
14
{
15
    use TimestampableAwareTrait;
16
    use VisibilityAwareTrait;
17
    use TimeLimitedAwareTrait;
18
19
    private $id;
20
21
    private $title;
22
23
    private $description;
24
25
    private $sku;
26
27
    private $coverImageName;
28
29
    private $coverImageFile;
30
31
    private $authors;
32
33
    public function __construct()
34
    {
35
        $this->setVisible(true);
36
        $this->setAuthors(new ArrayCollection());
37
    }
38
39
    public function getId(): ?int
40
    {
41
        return $this->id;
42
    }
43
44
    public function getTitle(): ?string
45
    {
46
        return $this->title;
47
    }
48
49
    public function setTitle(string $title): void
50
    {
51
        $this->title = $title;
52
    }
53
54
    public function getDescription(): ?string
55
    {
56
        return $this->description;
57
    }
58
59
    public function setDescription(string $description): void
60
    {
61
        $this->description = $description;
62
    }
63
64
    public function getSku(): ?string
65
    {
66
        return $this->sku;
67
    }
68
69
    public function setSku(string $sku): void
70
    {
71
        $this->sku = $sku;
72
    }
73
74
    public function getCoverImageName(): ?string
75
    {
76
        return $this->coverImageName;
77
    }
78
79
    public function setCoverImageName(?string $coverImageName): void
80
    {
81
        $this->coverImageName = $coverImageName;
82
    }
83
84
    public function setCoverImageFile(?File $coverImageFile = null): void
85
    {
86
        $this->coverImageFile = $coverImageFile;
87
        $this->updated = new \DateTime();
88
    }
89
90
    public function getCoverImageFile(): ?File
91
    {
92
        return $this->coverImageFile;
93
    }
94
95
    public function getAuthors(): Collection
96
    {
97
        return $this->authors;
98
    }
99
100
    public function setAuthors(Collection $authors): void
101
    {
102
        $this->authors = $authors;
103
    }
104
105
    public function __toString()
106
    {
107
        return (string) ($this->title ?? 'New course');
108
    }
109
}
110