PHP Class duncan3dc\Sonos\Queue

Inheritance: implements Countable
Datei anzeigen Open project: duncan3dc/sonos Class Usage Examples

Protected Properties

Property Type Description
$controller Controller The Controller instance this queue is for.
$id string The unique id of the queue.
$trackFactory duncan3dc\Sonos\Tracks\Factory A factory to create tracks from.
$updateId The current update id to be issued with upnp requests.

Public Methods

Method Description
__construct ( Controller $controller ) Create an instance of the Queue class.
addTrack ( string | duncan3dc\Sonos\Tracks\UriInterface $track, integer $position = null ) : boolean Add a track to the queue.
addTracks ( array $tracks, integer $position = null ) : boolean Add tracks to the queue.
clear ( ) : static Remove all tracks from the queue.
count ( ) : integer The the number of tracks in the queue.
getTracks ( integer $start, integer $total ) : duncan3dc\Sonos\Tracks\Track[] Get tracks from the queue.
removeTrack ( integer $position ) : boolean Remove a track from the queue.
removeTracks ( array $positions ) : boolean Remove tracks from the queue.

Protected Methods

Method Description
addUris ( array $tracks, integer $position = null ) : boolean Add multiple uris to the queue.
browse ( string $type, integer $start, integer $limit = 1 ) : mixed Send a browse request to the controller to get queue info.
getNextPosition ( ) : integer Calculate the position number to be used to add a track to the end of the queue.
getUpdateId ( ) : integer Get the next update id, or used the previously cached one.
soap ( string $service, string $action, array $params = [] ) : mixed Send a soap request to the controller for this queue.

Method Details

__construct() public method

Create an instance of the Queue class.
public __construct ( Controller $controller )
$controller Controller The Controller instance that this queue is for

addTrack() public method

Add a track to the queue.
public addTrack ( string | duncan3dc\Sonos\Tracks\UriInterface $track, integer $position = null ) : boolean
$track string | duncan3dc\Sonos\Tracks\UriInterface The URI of the track to add, or an object that implements the UriInterface
$position integer The position to insert the track in the queue (zero-based), by default the track will be added to the end of the queue
return boolean

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

addUris() protected method

Add multiple uris to the queue.
protected addUris ( array $tracks, integer $position = null ) : boolean
$tracks array The track to add
$position integer The position to insert the track in the queue (zero-based), by default the track will be added to the end of the queue
return boolean

browse() protected method

Send a browse request to the controller to get queue info.
protected browse ( string $type, integer $start, integer $limit = 1 ) : mixed
$type string The type of browse request to send
$start integer The position to start browsing from
$limit integer The number of tracks from the queue to return
return mixed

clear() public method

Remove all tracks from the queue.
public clear ( ) : static
return static

count() public method

The the number of tracks in the queue.
public count ( ) : integer
return integer

getNextPosition() protected method

Calculate the position number to be used to add a track to the end of the queue.
protected getNextPosition ( ) : integer
return integer

getTracks() public method

Get tracks from the queue.
public getTracks ( integer $start, integer $total ) : duncan3dc\Sonos\Tracks\Track[]
$start integer The zero-based position in the queue to start from
$total integer The maximum number of tracks to return
return duncan3dc\Sonos\Tracks\Track[]

getUpdateId() protected method

Get the next update id, or used the previously cached one.
protected getUpdateId ( ) : integer
return integer

removeTrack() public method

Remove a track from the queue.
public removeTrack ( integer $position ) : boolean
$position integer The zero-based position of the track to remove
return boolean

removeTracks() public method

Remove tracks from the queue.
public removeTracks ( array $positions ) : boolean
$positions array The zero-based positions of the tracks to remove
return boolean

soap() protected method

Send a soap request to the controller for this queue.
protected soap ( string $service, string $action, array $params = [] ) : mixed
$service string The service to send the request to
$action string The action to call
$params array The parameters to pass
return mixed

Property Details

$controller protected_oe property

The Controller instance this queue is for.
protected Controller,duncan3dc\Sonos $controller
return Controller

$id protected_oe property

The unique id of the queue.
protected string $id
return string

$trackFactory protected_oe property

A factory to create tracks from.
protected Factory,duncan3dc\Sonos\Tracks $trackFactory
return duncan3dc\Sonos\Tracks\Factory

$updateId protected_oe property

The current update id to be issued with upnp requests.
protected $updateId