Zend\Feed\PubSubHubbub\Subscriber
Synopsis
class Subscriber
{
- // members
- protected array $hubUrls;
- protected array $parameters;
- protected string $topicUrl;
- protected string $callbackUrl;
- protected int $leaseSeconds;
- protected string $preferredVerificationMode;
- protected array $errors;
- protected array $asyncHubs;
- protected SubscriptionPersistenceInterface $storage;
- protected array $authentications;
- protected string $usePathParameter;
- protected $testStaticToken;
- // methods
- public void __construct()
- public Subscriber setOptions()
- public Subscriber setTopicUrl()
- public string getTopicUrl()
- public Subscriber setLeaseSeconds()
- public int getLeaseSeconds()
- public Subscriber setCallbackUrl()
- public string getCallbackUrl()
- public Subscriber setPreferredVerificationMode()
- public string getPreferredVerificationMode()
- public Subscriber addHubUrl()
- public Subscriber addHubUrls()
- public Subscriber removeHubUrl()
- public array getHubUrls()
- public Subscriber addAuthentication()
- public Subscriber addAuthentications()
- public array getAuthentications()
- public Subscriber usePathParameter()
- public Subscriber setParameter()
- public Subscriber setParameters()
- public Subscriber removeParameter()
- public array getParameters()
- public Subscriber setStorage()
- public SubscriptionPersistenceInterface getStorage()
- public void subscribeAll()
- public void unsubscribeAll()
- public bool isSuccess()
- public array getErrors()
- public array getAsyncHubs()
- protected void _doRequest()
- protected Client _getHttpClient()
- protected string _getRequestParameters()
- protected string _generateVerifyToken()
- protected string _generateSubscriptionKey()
- protected array _urlEncode()
- protected array _toByteValueOrderedString()
- public final void setTestStaticToken()
Members
protected
- $asyncHubs
—
array
An array of Hub Server URLs for Hubs operating at this time in asynchronous verification mode. - $authentications
—
array
An array of authentication credentials for HTTP Basic Authentication if required by specific Hubs. The array is indexed by Hub Endpoint URI and the value is a simple array of the username and password to apply. - $callbackUrl
—
string
The URL Hub Servers must use when communicating with this Subscriber - $errors
—
array
An array of any errors including keys for 'response', 'hubUrl'. - $hubUrls
—
array
An array of URLs for all Hub Servers to subscribe/unsubscribe. - $leaseSeconds
—
int
The number of seconds for which the subscriber would like to have the subscription active. Defaults to null, i.e. not sent, to setup a permanent subscription if possible. - $parameters
—
array
An array of optional parameters to be included in any (un)subscribe requests. - $preferredVerificationMode
—
string
The preferred verification mode (sync or async). By default, this Subscriber prefers synchronous verification, but is considered desirable to support asynchronous verification if possible. - $storage
—
\Zend\Feed\PubSubHubbub\Model\SubscriptionPersistenceInterface
An instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used to background save any verification tokens associated with a subscription or other. -
$testStaticToken
This is STRICTLY for testing purposes only... - $topicUrl
—
string
The URL of the topic (Rss or Atom feed) which is the subject of our current intent to subscribe to/unsubscribe from updates from the currently configured Hub Servers. - $usePathParameter
—
string
Tells the Subscriber to append any subscription identifier to the path of the base Callback URL. E.g. an identifier "subkey1" would be added to the callback URL "http://www.example.com/callback" to create a subscription specific Callback URL of "http://www.example.com/callback/subkey1".
Methods
protected
- _doRequest() — Executes an (un)subscribe request
- _generateSubscriptionKey() — Simple helper to generate a verification token used in (un)subscribe requests to a Hub Server.
- _generateVerifyToken() — 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.
- _getHttpClient() — Get a basic prepared HTTP client for use
- _getRequestParameters() — Return a list of standard protocol/optional parameters for addition to client's POST body that are specific to the current Hub Server URL
- _toByteValueOrderedString() — Order outgoing parameters
- _urlEncode() — URL Encode an array of parameters
public
- __construct() — Constructor; accepts an array or Traversable instance to preset options for the Subscriber without calling all supported setter methods in turn.
- addAuthentication() — Add authentication credentials for a given URL
- addAuthentications() — Add authentication credentials for hub URLs
- addHubUrl() — Add a Hub Server URL supported by Publisher
- addHubUrls() — Add an array of Hub Server URLs supported by Publisher
- 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
- getErrors() — Return an array of errors met from any failures, including keys: 'response' => the Zend\Http\Response object from the failure 'hubUrl' => the URL of the Hub Server whose notification failed
- 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() — Gets an instance of Zend\Feed\Pubsubhubbub\Storage\StoragePersistence used to background save any verification tokens associated with a subscription or other.
- getTopicUrl() — Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate
- isSuccess() — Returns a boolean indicator of whether the notifications to Hub Servers were ALL successful. If even one failed, FALSE is returned.
- removeHubUrl() — Remove a Hub Server URL
- removeParameter() — Remove an optional parameter for the (un)subscribe requests
- setCallbackUrl() — Set the callback URL to be used by Hub Servers when communicating with this Subscriber
- setLeaseSeconds() — Set the number of seconds for which any subscription will remain valid
- setOptions() — Process any injected configuration options
- setParameter() — Add an optional parameter to the (un)subscribe requests
- setParameters() — Add an optional parameter to the (un)subscribe requests
- setPreferredVerificationMode() — 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.
- setStorage() — Sets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used to background save any verification tokens associated with a subscription or other.
- setTestStaticToken()
- setTopicUrl() — Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate
- 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() — Set flag indicating whether or not to use a path parameter