PLSPlaylist   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtension() 0 3 1
A __toString() 0 23 2
A getMIMEType() 0 3 1
1
<?php
2
3
/**
4
 * Represents an PLS playlist
5
 *
6
 * @author Sam Stenvall <[email protected]>
7
 * @copyright Copyright &copy; Sam Stenvall 2013-
8
 * @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0
9
 */
10
class PLSPlaylist extends Playlist
11
{
12
13
	public function __toString()
14
	{
15
		ob_start();
16
17
		// Header
18
		echo '[playlist]'.PHP_EOL;
19
20
		// Items
21
		$i = 1;
22
		foreach ($this->_items as $item)
23
		{
24
			echo "File$i=".$item->location.PHP_EOL;
25
			echo "Title$i=".$item->title.PHP_EOL;
26
			echo "Length$i=".$item->runtime.PHP_EOL;
27
28
			++$i;
29
		}
30
31
		// Footer
32
		echo "NumberOfEntries=$i".PHP_EOL;
33
		echo 'Version=2'.PHP_EOL;
34
35
		return ob_get_clean();
36
	}
37
38
	public function getExtension()
39
	{
40
		return 'pls';
41
	}
42
43
	public function getMIMEType()
44
	{
45
		return 'audio/x-scpls';
46
	}
47
48
}
49