Passed
Push — main ( 83d5fd...017968 )
by Daniel
04:36
created

Song::getAlbum()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Uxmp\Core\Orm\Model;
6
7
/**
8
 * @Entity(repositoryClass="\Uxmp\Core\Orm\Repository\SongRepository")
9
 * @Table(name="song")
10
 */
11
class Song implements SongInterface
12
{
13
    /**
14
     * @Id
15
     * @Column(type="integer")
16
     * @GeneratedValue
17
     */
18
    private int $id;
19
20
    /**
21
     * @Column(type="string")
22
     */
23
    private string $title = '';
24
25
    /**
26
     * @Column(type="integer")
27
     */
28
    private int $track_number = 0;
29
30
    /**
31
     * @Column(type="integer")
32
     */
33
    private int $artist_id;
34
35
    /**
36
     * @Column(type="integer")
37
     */
38
    private int $disc_id;
39
40
    /**
41
     * @Column(type="text")
42
     */
43
    private string $filename;
44
45
    /**
46
     * @Column(type="integer")
47
     */
48
    private int $catalog_id;
49
50
    /**
51
     * @Column(type="string", length="32", nullable=true, unique=true)
52
     */
53
    private ?string $mbid = null;
54
55
    /**
56
     * @Column(type="integer", length="5")
57
     */
58
    private int $length = 0;
59
60
    /**
61
     * @Column(type="integer", length="4", nullable=true)
62
     */
63
    private ?int $year = null;
64
65
    /**
66
     * @Column(type="string", nullable=true)
67
     */
68
    private ?string $mimeType = null;
69
70
    /**
71
     * @ManyToOne(targetEntity="Disc", inversedBy="songs")
72
     * @JoinColumn(name="disc_id", referencedColumnName="id", onDelete="CASCADE")
73
     */
74
    private DiscInterface $disc;
75
76
    /**
77
     * @ManyToOne(targetEntity="Artist")
78
     * @JoinColumn(name="artist_id", referencedColumnName="id")
79
     */
80
    private ArtistInterface $artist;
81
82
    /**
83
     * @ManyToOne(targetEntity="Catalog")
84
     * @JoinColumn(name="catalog_id", referencedColumnName="id", onDelete="CASCADE")
85
     */
86
    private CatalogInterface $catalog;
87
88
    public function getId(): int
89
    {
90
        return $this->id;
91
    }
92
93 1
    public function getTitle(): string
94
    {
95 1
        return $this->title;
96
    }
97
98 1
    public function setTitle(string $title): SongInterface
99
    {
100 1
        $this->title = $title;
101 1
        return $this;
102
    }
103
104 1
    public function getArtist(): ArtistInterface
105
    {
106 1
        return $this->artist;
107
    }
108
109 1
    public function setArtist(ArtistInterface $artist): SongInterface
110
    {
111 1
        $this->artist = $artist;
112 1
        return $this;
113
    }
114
115 1
    public function getTrackNumber(): int
116
    {
117 1
        return $this->track_number;
118
    }
119
120 1
    public function setTrackNumber(int $track_number): SongInterface
121
    {
122 1
        $this->track_number = $track_number;
123 1
        return $this;
124
    }
125
126 1
    public function getFilename(): string
127
    {
128 1
        return $this->filename;
129
    }
130
131 1
    public function setFilename(string $filename): SongInterface
132
    {
133 1
        $this->filename = $filename;
134 1
        return $this;
135
    }
136
137 1
    public function getMbid(): ?string
138
    {
139 1
        return $this->mbid;
140
    }
141
142 1
    public function setMbid(?string $mbid): SongInterface
143
    {
144 1
        $this->mbid = $mbid;
145 1
        return $this;
146
    }
147
148 2
    public function getDisc(): DiscInterface
149
    {
150 2
        return $this->disc;
151
    }
152
153 2
    public function setDisc(DiscInterface $disc): SongInterface
154
    {
155 2
        $this->disc = $disc;
156 2
        return $this;
157
    }
158
159 1
    public function getCatalog(): CatalogInterface
160
    {
161 1
        return $this->catalog;
162
    }
163
164 1
    public function setCatalog(CatalogInterface $catalog): SongInterface
165
    {
166 1
        $this->catalog = $catalog;
167 1
        return $this;
168
    }
169
170 1
    public function getLength(): int
171
    {
172 1
        return $this->length;
173
    }
174
175 1
    public function setLength(int $length): SongInterface
176
    {
177 1
        $this->length = $length;
178 1
        return $this;
179
    }
180
181 1
    public function getType(): string
182
    {
183 1
        return 'song';
184
    }
185
186 1
    public function getYear(): ?int
187
    {
188 1
        return $this->year;
189
    }
190
191 1
    public function setYear(?int $year): SongInterface
192
    {
193 1
        $this->year = $year;
194 1
        return $this;
195
    }
196
197 1
    public function getMimeType(): ?string
198
    {
199 1
        return $this->mimeType;
200
    }
201
202 1
    public function setMimeType(?string $mimeType): SongInterface
203
    {
204 1
        $this->mimeType = $mimeType;
205 1
        return $this;
206
    }
207
208 1
    public function getAlbum(): AlbumInterface
209
    {
210 1
        return $this->getDisc()->getAlbum();
211
    }
212
}
213