duncan3dc\Sonos\Queue::addTracks PHP Method

addTracks() public method

Add tracks to the queue.
public addTracks ( array $tracks, integer $position = null ) : boolean
$tracks array An array where each element is either the URI of the tracks to add, or an object that implements the UriInterface
$position integer The position to insert the tracks in the queue (zero-based), by default the tracks will be added to the end of the queue
return boolean
    public function addTracks(array $tracks, $position = null)
    {
        foreach ($tracks as &$track) {
            # If a simple uri has been passed then convert it to a Track instance
            if (is_string($track)) {
                $track = $this->trackFactory->createFromUri($track);
            }
            if (!$track instanceof UriInterface) {
                throw new \InvalidArgumentException("The addTracks() array must contain either string URIs or objects that implement \\duncan3dc\\Sonos\\Tracks\\UriInterface");
            }
        }
        unset($track);
        return $this->addUris($tracks, $position);
    }