M3UPlaylist   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 26
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtension() 0 3 1
A __toString() 0 13 2
A getMIMEType() 0 3 1
1
<?php
2
3
/**
4
 * Represents an M3U playlist
5
 *
6
 * @author Sam Stenvall <[email protected]>
7
 * @author Víctor Zabalza <[email protected]>
8
 * @copyright Copyright &copy; Sam Stenvall 2013-
9
 * @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0
10
 */
11
class M3UPlaylist extends Playlist
12
{
13
	
14
	public function getExtension()
15
	{
16
		return 'm3u';
17
	}
18
	
19
	public function getMIMEType()
20
	{
21
		return 'audio/x-mpegurl';
22
	}
23
	
24
	public function __toString()
25
	{
26
		ob_start();
27
28
		echo '#EXTM3U'.PHP_EOL;
29
30
		foreach ($this->_items as $item)
31
		{
32
			echo "#EXTINF:".$item->runtime.','.$item->title.PHP_EOL;
33
			echo $item->location.PHP_EOL;
34
		}
35
36
		return ob_get_clean();
37
	}
38
39
}