1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Metadata package. |
4
|
|
|
* |
5
|
|
|
* @author Daniel Schröder <[email protected]> |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace GravityMedia\Metadata\ID3v2; |
9
|
|
|
|
10
|
|
|
use GravityMedia\Metadata\Exception\BadMethodCallException; |
11
|
|
|
use GravityMedia\Metadata\ID3v2\Enum\Version; |
12
|
|
|
use GravityMedia\Metadata\Metadata\TagInterface; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* ID3v2 tag |
16
|
|
|
* |
17
|
|
|
* @package GravityMedia\Metadata\ID3v2 |
18
|
|
|
*/ |
19
|
|
|
class Tag implements TagInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var Header |
23
|
|
|
*/ |
24
|
|
|
protected $header; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var ExtendedHeader |
28
|
|
|
*/ |
29
|
|
|
protected $extendedHeader; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var \ArrayObject |
33
|
|
|
*/ |
34
|
|
|
protected $frames; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Create tag object. |
38
|
|
|
* |
39
|
|
|
* @param Header $header |
40
|
|
|
*/ |
41
|
|
|
public function __construct(Header $header) |
42
|
|
|
{ |
43
|
|
|
$this->header = $header; |
44
|
|
|
$this->frames = new \ArrayObject(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Set extended header |
49
|
|
|
* |
50
|
|
|
* @param ExtendedHeader $extendedHeader |
51
|
|
|
* |
52
|
|
|
* @throws BadMethodCallException An exception is thrown on ID3 v2.2 tag |
53
|
|
|
* |
54
|
|
|
* @return $this |
55
|
|
|
*/ |
56
|
|
|
public function setExtendedHeader(ExtendedHeader $extendedHeader) |
57
|
|
|
{ |
58
|
|
|
if (!in_array($this->getVersion(), [Version::VERSION_23, Version::VERSION_24])) { |
59
|
|
|
throw new BadMethodCallException('Extended header is not supported in this version.'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
$this->extendedHeader = $extendedHeader; |
63
|
|
|
|
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* {@inheritdoc} |
69
|
|
|
*/ |
70
|
|
|
public function getVersion() |
71
|
|
|
{ |
72
|
|
|
return $this->header->getVersion(); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* {@inheritdoc} |
77
|
|
|
*/ |
78
|
|
|
public function getTitle() |
79
|
|
|
{ |
80
|
|
|
// TODO: Implement getTitle() method. |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* {@inheritdoc} |
85
|
|
|
*/ |
86
|
|
|
public function getArtist() |
87
|
|
|
{ |
88
|
|
|
// TODO: Implement getArtist() method. |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* {@inheritdoc} |
93
|
|
|
*/ |
94
|
|
|
public function getAlbum() |
95
|
|
|
{ |
96
|
|
|
// TODO: Implement getAlbum() method. |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* {@inheritdoc} |
101
|
|
|
*/ |
102
|
|
|
public function getYear() |
103
|
|
|
{ |
104
|
|
|
// TODO: Implement getYear() method. |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* {@inheritdoc} |
109
|
|
|
*/ |
110
|
|
|
public function getComment() |
111
|
|
|
{ |
112
|
|
|
// TODO: Implement getComment() method. |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* {@inheritdoc} |
117
|
|
|
*/ |
118
|
|
|
public function getTrack() |
119
|
|
|
{ |
120
|
|
|
// TODO: Implement getTrack() method. |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* {@inheritdoc} |
125
|
|
|
*/ |
126
|
|
|
public function getGenre() |
127
|
|
|
{ |
128
|
|
|
// TODO: Implement getGenre() method. |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* {@inheritdoc} |
133
|
|
|
*/ |
134
|
|
|
public function getFrames() |
135
|
|
|
{ |
136
|
|
|
return $this->frames; |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
|