Queue
in package
implements
QueueInterface
Provides an interface for managing the queue of a controller.
Table of Contents
Interfaces
- QueueInterface
- Provides an interface for managing the queue of a controller.
Properties
- $controller : ControllerInterface
- $id : string
- $trackFactory : FactoryInterface
- $updateId : int
Methods
- __construct() : mixed
- Create an instance of the Queue class.
- addTrack() : $this
- Add a track to the queue.
- addTracks() : $this
- Add tracks to the queue.
- clear() : QueueInterface
- Remove all tracks from the queue.
- count() : int
- Get the number of tracks in the queue.
- getTracks() : array<string|int, TrackInterface>
- Get tracks from the queue.
- removeTrack() : bool
- Remove a track from the queue.
- removeTracks() : bool
- Remove tracks from the queue.
- addUris() : void
- Add multiple uris to the queue.
- browse() : array<string, string>
- Send a browse request to the controller to get queue info.
- getNextPosition() : int
- Calculate the position number to be used to add a track to the end of the queue.
- getUpdateId() : int
- Get the next update id, or used the previously cached one.
- soap() : SoapResponse
- Send a soap request to the controller for this queue.
Properties
$controller
protected
ControllerInterface
$controller
The Controller instance this queue is for.
$id
protected
string
$id
The unique id of the queue.
$trackFactory
protected
FactoryInterface
$trackFactory
A factory to create tracks from.
$updateId
protected
int
$updateId
= 0
The current update id to be issued with upnp requests.
Methods
__construct()
Create an instance of the Queue class.
public
__construct(ControllerInterface $controller[, FactoryInterface|null $factory = null ]) : mixed
Parameters
- $controller : ControllerInterface
-
The Controller instance that this queue is for
- $factory : FactoryInterface|null = null
-
A factory to create tracks from
addTrack()
Add a track to the queue.
public
addTrack(string|UriInterface $track[, int|null $position = null ]) : $this
Parameters
- $track : string|UriInterface
-
The URI of the track to add, or an object that implements the UriInterface
- $position : int|null = null
-
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 values
$thisaddTracks()
Add tracks to the queue.
public
addTracks(array<string|int, string>|array<string|int, UriInterface> $tracks[, int|null $position = null ]) : $this
Parameters
- $tracks : array<string|int, string>|array<string|int, UriInterface>
-
An array where each element is either the URI of the tracks to add, or an object that implements the UriInterface
- $position : int|null = null
-
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 values
$thisclear()
Remove all tracks from the queue.
public
clear() : QueueInterface
Return values
QueueInterfacecount()
Get the number of tracks in the queue.
public
count() : int
Return values
intgetTracks()
Get tracks from the queue.
public
getTracks([int $start = 0 ][, int $total = 0 ]) : array<string|int, TrackInterface>
Parameters
- $start : int = 0
-
The zero-based position in the queue to start from
- $total : int = 0
-
The maximum number of tracks to return
Return values
array<string|int, TrackInterface>removeTrack()
Remove a track from the queue.
public
removeTrack(int $position) : bool
Parameters
- $position : int
-
The zero-based position of the track to remove
Return values
boolremoveTracks()
Remove tracks from the queue.
public
removeTracks(array<string|int, int> $positions) : bool
Parameters
- $positions : array<string|int, int>
-
The zero-based positions of the tracks to remove
Return values
booladdUris()
Add multiple uris to the queue.
protected
addUris(array<string|int, UriInterface> $tracks[, int|null $position = null ]) : void
Parameters
- $tracks : array<string|int, UriInterface>
-
The track to add
- $position : int|null = null
-
The position to insert the track in the queue (zero-based), by default the track will be added to the end of the queue
browse()
Send a browse request to the controller to get queue info.
protected
browse(string $type[, int $start = 0 ][, int $limit = 1 ]) : array<string, string>
Parameters
- $type : string
-
The type of browse request to send
- $start : int = 0
-
The position to start browsing from
- $limit : int = 1
-
The number of tracks from the queue to return
Return values
array<string, string>getNextPosition()
Calculate the position number to be used to add a track to the end of the queue.
protected
getNextPosition() : int
Return values
intgetUpdateId()
Get the next update id, or used the previously cached one.
protected
getUpdateId() : int
Return values
intsoap()
Send a soap request to the controller for this queue.
protected
soap(string $service, string $action[, array<string, string|int|bool> $params = [] ]) : SoapResponse
Parameters
- $service : string
-
The service to send the request to
- $action : string
-
The action to call
- $params : array<string, string|int|bool> = []
-
The parameters to pass