Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function __toString() |
||
42 | { |
||
43 | $document = new \DOMDocument('1.0', 'UTF-8'); |
||
44 | |||
45 | // Create and add the playlist element |
||
46 | $playlist = $document->createElement('playlist'); |
||
47 | $playlist->setAttribute('version', self::XSPF_VERSION); |
||
48 | $playlist->setAttribute('xmlns', self::XSPF_XMLNS); |
||
49 | $document->appendChild($playlist); |
||
50 | |||
51 | // Create and add the trackList element |
||
52 | $trackList = $document->createElement('trackList'); |
||
53 | $playlist->appendChild($trackList); |
||
54 | |||
55 | // Add track elements |
||
56 | foreach ($this->trackList as $track) { |
||
57 | $trackList->appendChild($track->getDomElement($document)); |
||
58 | } |
||
59 | |||
60 | // Use pretty printing |
||
61 | $document->formatOutput = true; |
||
62 | |||
63 | return $document->saveXML(); |
||
64 | } |
||
67 |