public function handle(Command $command)
 {
     $request = $command->getRequest();
     $playlist = Playlist::create(uniqid(), $request->get('name'));
     $this->playlist_repository->add($playlist);
     return $playlist;
 }
Example #2
0
 private function buildPlaylist($raw_playlist)
 {
     $playlist = Playlist::create($raw_playlist['id'], $raw_playlist['name']);
     if (isset($raw_playlist['tracks'])) {
         foreach ($raw_playlist['tracks'] as $raw_track) {
             $track = new \stdClass();
             $track->id = $raw_track['id'];
             $track->name = $raw_track['name'];
             $playlist->addTrack($this->track_builder->buildTrack($track));
         }
     }
     return $playlist;
 }
Example #3
0
 public function build()
 {
     return Playlist::create($this->id, $this->name);
 }