Documentation

Subscription
in package

A simple DTO for subscriptions to a topic which need to be stored in a repository.

Table of Contents

$callback  : Closure|null
$qualityOfService  : int
$regexifiedTopicFilter  : string
$topicFilter  : string
__construct()  : mixed
Creates a new subscription object.
getCallback()  : Closure|null
Returns the callback for this subscription.
getMatchedWildcards()  : array<string|int, mixed>
Returns an array which contains all matched wildcards of this subscription, taken from the given topic name.
getQualityOfServiceLevel()  : int
Returns the requested quality of service level.
getTopicFilter()  : string
Returns the topic of the subscription.
matchesTopic()  : bool
Matches the given topic name matches to the subscription's topic filter.
setQualityOfServiceLevel()  : void
Sets the actual quality of service level.
regexifyTopicFilter()  : void
Converts the topic filter into a regular expression.

Properties

$regexifiedTopicFilter

private string $regexifiedTopicFilter

Methods

__construct()

Creates a new subscription object.

public __construct(string $topicFilter, int $qualityOfService[, Closure|null $callback = null ]) : mixed
Parameters
$topicFilter : string
$qualityOfService : int
$callback : Closure|null = null
Return values
mixed

getCallback()

Returns the callback for this subscription.

public getCallback() : Closure|null
Return values
Closure|null

getMatchedWildcards()

Returns an array which contains all matched wildcards of this subscription, taken from the given topic name.

public getMatchedWildcards(string $topicName) : array<string|int, mixed>

Example: Subscription topic filter: foo/+/bar/+/baz/# Result for 'foo/1/bar/2/baz': ['1', '2'] Result for 'foo/my/bar/subscription/baz/42': ['my', 'subscription', '42'] Result for 'foo/my/bar/subscription/baz/hello/world/123': ['my', 'subscription', 'hello', 'world', '123'] Result for invalid topic 'some/topic': []

Note: This method should only be called if matchesTopic returned true. An empty array will be returned otherwise.

Parameters
$topicName : string
Return values
array<string|int, mixed>

getQualityOfServiceLevel()

Returns the requested quality of service level.

public getQualityOfServiceLevel() : int
Return values
int

getTopicFilter()

Returns the topic of the subscription.

public getTopicFilter() : string
Return values
string

matchesTopic()

Matches the given topic name matches to the subscription's topic filter.

public matchesTopic(string $topicName) : bool
Parameters
$topicName : string
Return values
bool

setQualityOfServiceLevel()

Sets the actual quality of service level.

public setQualityOfServiceLevel(int $qualityOfService) : void
Parameters
$qualityOfService : int
Return values
void

regexifyTopicFilter()

Converts the topic filter into a regular expression.

private regexifyTopicFilter() : void
Return values
void

Search results