Beispiel #1
0
 function parseSongsToArray($pairs, &$array)
 {
     foreach ($pairs as $key => $value) {
         switch ($value[0]) {
             case "file":
                 if (isset($song)) {
                     array_push($array, $song);
                     $song = null;
                 }
                 $song = new Song($value[1]);
                 break;
             case "Artist":
                 $song->setArtist($value[1]);
                 break;
             case "Album":
                 $song->setAlbum($value[1]);
                 break;
             case "Track":
                 $song->setTrack($value[1]);
                 break;
             case "Title":
                 $song->setTitle($value[1]);
                 break;
             case "Time":
                 $song->setTime($value[1]);
                 break;
             case "directory":
                 array_push($this->currentDirs, $value[1]);
                 break;
             case "playlist":
                 $this->playlistList->add($value[1]);
                 break;
         }
     }
     if (isset($song)) {
         array_push($array, $song);
         $song = null;
     }
 }