public function addTracks(array $tracks, int $position = null): QueueInterface
    {
        $uris = [];
        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) {
                $error = "The tracks must contain either string URIs or objects that implement " . UriInterface::class;
                throw new \InvalidArgumentException($error);
            }

            $uris[] = $track;
        }

        $this->addUris($uris, $position);

        return $this;
    }
public function addTracks(array $tracks, int $position = null): QueueInterface
    {
        $uris = [];
        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) {
                $error = "The tracks must contain either string URIs or objects that implement " . UriInterface::class;
                throw new \InvalidArgumentException($error);
            }

            $uris[] = $track;
        }

        $this->addUris($uris, $position);

        return $this;
    }
public function addTracks ( array $ tracks , int $ position = null ) : QueueInterface { $ uris = [ ] ; 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 ) { $ error = "The tracks must contain either string URIs or objects that implement " . UriInterface :: class ; throw new \ InvalidArgumentException ( $ error ) ; } $ uris [ ] = $ track ; } $ this -> addUris ( $ uris , $ position ) ; return $ this ; }
Add tracks to the queue.

@param string[]|UriInterface[] $tracks An array where each element is either the URI of the tracks to add,
or an object that implements the UriInterface
@param int $position 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 $this
Add tracks to the queue .