HumHub Documentation (unofficial)

StreamResponse

This class is used to build up a stream array or json response used in stream actions.

Tags
since
1.7

Table of Contents

Properties

$entries  : array<string|int, mixed>
$entryOrder  : array<string|int, mixed>
$error  : string
$errorCode  : int
$lastContentId  : int
$result  : array<string|int, mixed>
$streamQuery  : StreamQuery

Methods

__construct()  : mixed
StreamResponse constructor.
addEntry()  : mixed
Adds entries to the response by providing either an response array or a StreamEntryResponse instance.
asArray()  : array<string|int, mixed>
Returns the stream response array.
asJson()  : Response
Returns the stream action result as json response.
setError()  : mixed
Can be used to set error information.
isLast()  : mixed

Properties

$entries

public array<string|int, mixed> $entries = []

contains the result array of the different entries

$entryOrder

public array<string|int, mixed> $entryOrder = []

contains the order of entries

$result

private array<string|int, mixed> $result = []

resulting array

Methods

addEntry()

Adds entries to the response by providing either an response array or a StreamEntryResponse instance.

public addEntry(array<string|int, mixed>|StreamEntryResponse $entry[, bool|int $injectIndex = false ]) : mixed

An $entry array needs at least to provide a id and output value. When injecting an entry outside of the stream query result the $injectIndex should be set to either an existing result index or to true. This will make sure the injected entry will be ignored in the stream flow (load more).

Parameters
$entry : array<string|int, mixed>|StreamEntryResponse
$injectIndex : bool|int = false
Tags
throws
Exception

asArray()

Returns the stream response array.

public asArray() : array<string|int, mixed>
Tags
throws
Exception
Return values
array<string|int, mixed>

setError()

Can be used to set error information.

public setError(mixed $code, mixed $msg) : mixed
Parameters
$code : mixed

int

$msg : mixed

string

isLast()

private isLast(mixed $isLast) : mixed
Parameters
$isLast : mixed

bool sets the isLast flag of the response


        
On this page

Search results