Zend Framework
3.0
|
Public Member Functions | |
__construct ($options=null) | |
Constructor; accepts an array or Traversable instance to preset options for the Subscriber without calling all supported setter methods in turn. | |
setOptions ($options) | |
Process any injected configuration options. | |
setTopicUrl ($url) | |
Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate. | |
getTopicUrl () | |
Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate. | |
setLeaseSeconds ($seconds) | |
Set the number of seconds for which any subscription will remain valid. | |
getLeaseSeconds () | |
Get the number of lease seconds on subscriptions. | |
setCallbackUrl ($url) | |
Set the callback URL to be used by Hub Servers when communicating with this Subscriber. | |
getCallbackUrl () | |
Get the callback URL to be used by Hub Servers when communicating with this Subscriber. | |
setPreferredVerificationMode ($mode) | |
Set preferred verification mode (sync or async). | |
getPreferredVerificationMode () | |
Get preferred verification mode (sync or async). | |
addHubUrl ($url) | |
Add a Hub Server URL supported by Publisher. | |
addHubUrls (array $urls) | |
Add an array of Hub Server URLs supported by Publisher. | |
removeHubUrl ($url) | |
Remove a Hub Server URL. | |
getHubUrls () | |
Return an array of unique Hub Server URLs currently available. | |
addAuthentication ($url, array $authentication) | |
Add authentication credentials for a given URL. | |
addAuthentications (array $authentications) | |
Add authentication credentials for hub URLs. | |
getAuthentications () | |
Get all hub URL authentication credentials. | |
usePathParameter ($bool=true) | |
Set flag indicating whether or not to use a path parameter. | |
setParameter ($name, $value=null) | |
Add an optional parameter to the (un)subscribe requests. | |
setParameters (array $parameters) | |
Add an optional parameter to the (un)subscribe requests. | |
removeParameter ($name) | |
Remove an optional parameter for the (un)subscribe requests. | |
getParameters () | |
Return an array of optional parameters for (un)subscribe requests. | |
setStorage (Model\SubscriptionPersistenceInterface $storage) | |
Sets an instance of Zend used to background save any verification tokens associated with a subscription or other. | |
getStorage () | |
Gets an instance of Zend used to background save any verification tokens associated with a subscription or other. | |
subscribeAll () | |
Subscribe to one or more Hub Servers using the stored Hub URLs for the given Topic URL (RSS or Atom feed) | |
unsubscribeAll () | |
Unsubscribe from one or more Hub Servers using the stored Hub URLs for the given Topic URL (RSS or Atom feed) | |
isSuccess () | |
Returns a boolean indicator of whether the notifications to Hub Servers were ALL successful. | |
getErrors () | |
Return an array of errors met from any failures, including keys: 'response' => the Zend object from the failure 'hubUrl' => the URL of the Hub Server whose notification failed. | |
getAsyncHubs () | |
Return an array of Hub Server URLs who returned a response indicating operation in Asynchronous Verification Mode, i.e. | |
setTestStaticToken ($token) | |
Protected Member Functions | |
_doRequest ($mode) | |
Executes an (un)subscribe request. | |
_getHttpClient () | |
Get a basic prepared HTTP client for use. | |
_getRequestParameters ($hubUrl, $mode) | |
Return a list of standard protocol/optional parameters for addition to client's POST body that are specific to the current Hub Server URL. | |
_generateVerifyToken () | |
Simple helper to generate a verification token used in (un)subscribe requests to a Hub Server. | |
_generateSubscriptionKey (array $params, $hubUrl) | |
Simple helper to generate a verification token used in (un)subscribe requests to a Hub Server. | |
_urlEncode (array $params) | |
URL Encode an array of parameters. | |
_toByteValueOrderedString (array $params) | |
Order outgoing parameters. | |
Protected Attributes | |
$hubUrls = [] | |
$parameters = [] | |
$topicUrl = '' | |
$callbackUrl = '' | |
$leaseSeconds = null | |
$preferredVerificationMode = PubSubHubbub::VERIFICATION_MODE_SYNC | |
$errors = [] | |
$asyncHubs = [] | |
$storage = null | |
$authentications = [] | |
$usePathParameter = false | |
$testStaticToken = null | |
This is STRICTLY for testing purposes only... | |
__construct | ( | $options = null | ) |
Constructor; accepts an array or Traversable instance to preset options for the Subscriber without calling all supported setter methods in turn.
array | Traversable | $options |
|
protected |
Executes an (un)subscribe request.
string | $mode |
Exception\RuntimeException |
At first I thought it was needed, but the backend storage will allow tracking async without any user interference. It's left here in case the user is interested in knowing what Hubs are using async verification modes so they may update Models and move these to asynchronous processes.
|
protected |
|
protected |
Simple helper to generate a verification token used in (un)subscribe requests to a Hub Server.
Follows no particular method, which means it might be improved/changed in future.
|
protected |
Get a basic prepared HTTP client for use.
|
protected |
Return a list of standard protocol/optional parameters for addition to client's POST body that are specific to the current Hub Server URL.
string | $hubUrl | |
string | $mode |
Exception\InvalidArgumentException |
Establish a persistent verify_token and attach key to callback URL's path/query_string
|
protected |
Order outgoing parameters.
array | $params |
|
protected |
URL Encode an array of parameters.
array | $params |
addAuthentication | ( | $url, | |
array | $authentication | ||
) |
Add authentication credentials for a given URL.
string | $url | |
array | $authentication |
Exception\InvalidArgumentException |
addAuthentications | ( | array | $authentications | ) |
addHubUrl | ( | $url | ) |
Add a Hub Server URL supported by Publisher.
string | $url |
Exception\InvalidArgumentException |
addHubUrls | ( | array | $urls | ) |
getAsyncHubs | ( | ) |
Return an array of Hub Server URLs who returned a response indicating operation in Asynchronous Verification Mode, i.e.
they will not confirm any (un)subscription immediately but at a later time (Hubs may be doing this as a batch process when load balancing)
getAuthentications | ( | ) |
Get all hub URL authentication credentials.
getCallbackUrl | ( | ) |
Get the callback URL to be used by Hub Servers when communicating with this Subscriber.
Exception\RuntimeException |
getErrors | ( | ) |
getHubUrls | ( | ) |
Return an array of unique Hub Server URLs currently available.
getLeaseSeconds | ( | ) |
Get the number of lease seconds on subscriptions.
getParameters | ( | ) |
Return an array of optional parameters for (un)subscribe requests.
getPreferredVerificationMode | ( | ) |
Get preferred verification mode (sync or async).
getStorage | ( | ) |
getTopicUrl | ( | ) |
Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate.
Exception\RuntimeException |
isSuccess | ( | ) |
Returns a boolean indicator of whether the notifications to Hub Servers were ALL successful.
If even one failed, FALSE is returned.
removeHubUrl | ( | $url | ) |
removeParameter | ( | $name | ) |
Remove an optional parameter for the (un)subscribe requests.
string | $name |
Exception\InvalidArgumentException |
setCallbackUrl | ( | $url | ) |
Set the callback URL to be used by Hub Servers when communicating with this Subscriber.
string | $url |
Exception\InvalidArgumentException |
setLeaseSeconds | ( | $seconds | ) |
Set the number of seconds for which any subscription will remain valid.
int | $seconds |
Exception\InvalidArgumentException |
setOptions | ( | $options | ) |
Process any injected configuration options.
array | Traversable | $options |
Exception\InvalidArgumentException |
setParameter | ( | $name, | |
$value = null |
|||
) |
Add an optional parameter to the (un)subscribe requests.
string | $name | |
string | null | $value |
Exception\InvalidArgumentException |
setParameters | ( | array | $parameters | ) |
Add an optional parameter to the (un)subscribe requests.
array | $parameters |
setPreferredVerificationMode | ( | $mode | ) |
Set preferred verification mode (sync or async).
By default, this Subscriber prefers synchronous verification, but does support asynchronous if that's the Hub Server's utilised mode.
Zend will always send both modes, whose order of occurrence in the parameter list determines this preference.
string | $mode | Should be 'sync' or 'async' |
Exception\InvalidArgumentException |
setStorage | ( | Model\SubscriptionPersistenceInterface | $storage | ) |
Sets an instance of Zend used to background save any verification tokens associated with a subscription or other.
Model\SubscriptionPersistenceInterface | $storage |
|
final |
setTopicUrl | ( | $url | ) |
Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate.
string | $url |
Exception\InvalidArgumentException |
subscribeAll | ( | ) |
Subscribe to one or more Hub Servers using the stored Hub URLs for the given Topic URL (RSS or Atom feed)
unsubscribeAll | ( | ) |
Unsubscribe from one or more Hub Servers using the stored Hub URLs for the given Topic URL (RSS or Atom feed)
usePathParameter | ( | $bool = true | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
This is STRICTLY for testing purposes only...
|
protected |
|
protected |