PHP Class duncan3dc\Sonos\Queue

Inheritance: implements Countable
Afficher le fichier Open project: duncan3dc/sonos Class Usage Examples

Protected Properties

Свойство 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.

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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

addTrack() public méthode

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
Résultat boolean

addTracks() public méthode

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
Résultat boolean

addUris() protected méthode

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
Résultat boolean

browse() protected méthode

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
Résultat mixed

clear() public méthode

Remove all tracks from the queue.
public clear ( ) : static
Résultat static

count() public méthode

The the number of tracks in the queue.
public count ( ) : integer
Résultat integer

getNextPosition() protected méthode

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

getTracks() public méthode

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
Résultat duncan3dc\Sonos\Tracks\Track[]

getUpdateId() protected méthode

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

removeTrack() public méthode

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

removeTracks() public méthode

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

soap() protected méthode

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
Résultat mixed

Property Details

$controller protected_oe property

The Controller instance this queue is for.
protected Controller,duncan3dc\Sonos $controller
Résultat Controller

$id protected_oe property

The unique id of the queue.
protected string $id
Résultat string

$trackFactory protected_oe property

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

$updateId protected_oe property

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