1 | <?php |
||
19 | class TextFrameReader extends StreamContainer |
||
20 | { |
||
21 | /** |
||
22 | * String representations of encodings. |
||
23 | * |
||
24 | * @var string[] |
||
25 | */ |
||
26 | protected static $encodings = [ |
||
27 | Encoding::ISO_8859_1 => 'ISO-8859-1', |
||
28 | Encoding::UTF_8 => 'UTF-8', |
||
29 | Encoding::UTF_16 => 'UTF-16', |
||
30 | Encoding::UTF_16BE => 'UTF-16BE', |
||
31 | Encoding::UTF_16LE => 'UTF-16LE' |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * @var int |
||
36 | */ |
||
37 | private $textOffset; |
||
38 | |||
39 | /** |
||
40 | * @var int |
||
41 | */ |
||
42 | private $encoding; |
||
43 | |||
44 | /** |
||
45 | * @var string[] |
||
46 | */ |
||
47 | private $texts; |
||
48 | |||
49 | /** |
||
50 | * Create ID3v2 text frame reader object. |
||
51 | * |
||
52 | * @param Stream $stream |
||
53 | * @param int $textOffset |
||
54 | */ |
||
55 | public function __construct(Stream $stream, $textOffset = 1) |
||
61 | |||
62 | /** |
||
63 | * Read encoding. |
||
64 | * |
||
65 | * @return int |
||
66 | */ |
||
67 | protected function readEncoding() |
||
73 | |||
74 | /** |
||
75 | * Get encoding. |
||
76 | * |
||
77 | * @return int |
||
78 | */ |
||
79 | public function getEncoding() |
||
87 | |||
88 | /** |
||
89 | * Read texts. |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | protected function readTexts() |
||
105 | |||
106 | /** |
||
107 | * Get text. |
||
108 | * |
||
109 | * @param int $index |
||
110 | * |
||
111 | * @return null|string |
||
112 | */ |
||
113 | public function getText($index = 0) |
||
125 | } |
||
126 |