App\services\Download::from PHP Method

from() public method

Generic method to generate a download archive from various source types.
public from ( Song | Collection | Album | Artist | Playlist $mixed ) : string
$mixed app\models\Song | Collection | app\models\Album | app\models\Artist | app\models\Playlist
return string Full path to the generated archive
    public function from($mixed)
    {
        if (is_a($mixed, Song::class)) {
            return $this->fromSong($mixed);
        } elseif (is_a($mixed, Collection::class)) {
            return $this->fromMultipleSongs($mixed);
        } elseif (is_a($mixed, Album::class)) {
            return $this->fromAlbum($mixed);
        } elseif (is_a($mixed, Artist::class)) {
            return $this->fromArtist($mixed);
        } elseif (is_a($mixed, Playlist::class)) {
            return $this->fromPlaylist($mixed);
        } else {
            throw new Exception('Unsupport download type.');
        }
    }