1494. Class

1494.1. Zend\Feed\PubSubHubbub\Subscriber

1494.1.1. Methods

1494.1.1.1. __construct

__construct()

Constructor; accepts an array or Traversable instance to preset options for the Subscriber without calling all supported setter methods in turn.

Parameters:array|Traversable

1494.1.1.2. setOptions

setOptions()

Process any injected configuration options

Parameters:array|Traversable
Return type:Subscriber
Throws :ExceptionInvalidArgumentException

1494.1.1.3. setTopicUrl

setTopicUrl()

Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate

Parameters:string
Return type:Subscriber
Throws :ExceptionInvalidArgumentException

1494.1.1.4. getTopicUrl

getTopicUrl()

Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe event will relate

Return type:string
Throws :ExceptionRuntimeException

1494.1.1.5. setLeaseSeconds

setLeaseSeconds()

Set the number of seconds for which any subscription will remain valid

Parameters:int
Return type:Subscriber
Throws :ExceptionInvalidArgumentException

1494.1.1.6. getLeaseSeconds

getLeaseSeconds()

Get the number of lease seconds on subscriptions

Return type:int

1494.1.1.7. setCallbackUrl

setCallbackUrl()

Set the callback URL to be used by Hub Servers when communicating with this Subscriber

Parameters:string
Return type:Subscriber
Throws :ExceptionInvalidArgumentException

1494.1.1.8. getCallbackUrl

getCallbackUrl()

Get the callback URL to be used by Hub Servers when communicating with this Subscriber

Return type:string
Throws :ExceptionRuntimeException

1494.1.1.9. setPreferredVerificationMode

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.

ZendFeedPubsubhubbubSubscriber will always send both modes, whose order of occurrence in the parameter list determines this preference.

Parameters:string – Should be ‘sync’ or ‘async’
Return type:Subscriber
Throws :ExceptionInvalidArgumentException

1494.1.1.10. getPreferredVerificationMode

getPreferredVerificationMode()

Get preferred verification mode (sync or async).

Return type:string

1494.1.1.11. addHubUrl

addHubUrl()

Add a Hub Server URL supported by Publisher

Parameters:string
Return type:Subscriber
Throws :ExceptionInvalidArgumentException

1494.1.1.12. addHubUrls

addHubUrls()

Add an array of Hub Server URLs supported by Publisher

Parameters:array
Return type:Subscriber

1494.1.1.13. removeHubUrl

removeHubUrl()

Remove a Hub Server URL

Parameters:string
Return type:Subscriber

1494.1.1.14. getHubUrls

getHubUrls()

Return an array of unique Hub Server URLs currently available

Return type:array

1494.1.1.15. addAuthentication

addAuthentication()

Add authentication credentials for a given URL

Parameters:
  • string
  • array
Return type:

Subscriber

Throws :

ExceptionInvalidArgumentException

1494.1.1.16. addAuthentications

addAuthentications()

Add authentication credentials for hub URLs

Parameters:array
Return type:Subscriber

1494.1.1.17. getAuthentications

getAuthentications()

Get all hub URL authentication credentials

Return type:array

1494.1.1.18. usePathParameter

usePathParameter()

Set flag indicating whether or not to use a path parameter

Parameters:bool
Return type:Subscriber

1494.1.1.19. setParameter

setParameter()

Add an optional parameter to the (un)subscribe requests

Parameters:
  • string
  • string|null
Return type:

Subscriber

Throws :

ExceptionInvalidArgumentException

1494.1.1.20. setParameters

setParameters()

Add an optional parameter to the (un)subscribe requests

Parameters:array
Return type:Subscriber

1494.1.1.21. removeParameter

removeParameter()

Remove an optional parameter for the (un)subscribe requests

Parameters:string
Return type:Subscriber
Throws :ExceptionInvalidArgumentException

1494.1.1.22. getParameters

getParameters()

Return an array of optional parameters for (un)subscribe requests

Return type:array

1494.1.1.23. setStorage

setStorage()

Sets an instance of ZendFeedPubsubhubbubModelSubscriptionPersistence used to background save any verification tokens associated with a subscription or other.

Parameters:ModelSubscriptionPersistenceInterface
Return type:Subscriber

1494.1.1.24. getStorage

getStorage()

Gets an instance of ZendFeedPubsubhubbubStorageStoragePersistence used to background save any verification tokens associated with a subscription or other.

Return type:ModelSubscriptionPersistenceInterface
Throws :ExceptionRuntimeException

1494.1.1.25. subscribeAll

subscribeAll()

Subscribe to one or more Hub Servers using the stored Hub URLs for the given Topic URL (RSS or Atom feed)

Return type:void

1494.1.1.26. unsubscribeAll

unsubscribeAll()

Unsubscribe from one or more Hub Servers using the stored Hub URLs for the given Topic URL (RSS or Atom feed)

Return type:void

1494.1.1.27. isSuccess

isSuccess()

Returns a boolean indicator of whether the notifications to Hub Servers were ALL successful. If even one failed, FALSE is returned.

Return type:bool

1494.1.1.28. getErrors

getErrors()

Return an array of errors met from any failures, including keys: ‘response’ => the ZendHttpResponse object from the failure ‘hubUrl’ => the URL of the Hub Server whose notification failed

Return type:array

1494.1.1.29. getAsyncHubs

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)

Return type:array

1494.1.1.30. _doRequest

_doRequest()

Executes an (un)subscribe request

Parameters:string
Return type:void
Throws :ExceptionRuntimeException

1494.1.1.31. _getHttpClient

_getHttpClient()

Get a basic prepared HTTP client for use

Return type:ZendHttpClient

1494.1.1.32. _getRequestParameters

_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

Parameters:
  • string
  • string
Return type:

string

Throws :

ExceptionInvalidArgumentException

1494.1.1.33. _generateVerifyToken

_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.

Return type:string

1494.1.1.34. _generateSubscriptionKey

_generateSubscriptionKey()

Simple helper to generate a verification token used in (un)subscribe requests to a Hub Server.

Parameters:
  • array
  • string – The Hub Server URL for which this token will apply
Return type:

string

1494.1.1.35. _urlEncode

_urlEncode()

URL Encode an array of parameters

Parameters:array
Return type:array

1494.1.1.36. _toByteValueOrderedString

_toByteValueOrderedString()

Order outgoing parameters

Parameters:array
Return type:array

1494.1.1.37. setTestStaticToken

setTestStaticToken()

This is STRICTLY for testing purposes only...