Zend Framework  3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Callback Class Reference

Public Member Functions

 setSubscriptionKey ($key)
 Set a subscription key to use for the current callback request manually.
 
 handle (array $httpGetData=null, $sendResponseNow=false)
 Handle any callback from a Hub Server responding to a subscription or unsubscription request.
 
 isValidHubVerification (array $httpGetData)
 Checks validity of the request simply by making a quick pass and confirming the presence of all REQUIRED parameters.
 
 setFeedUpdate ($feed)
 Sets a newly received feed (Atom/RSS) sent by a Hub as an update to a Topic we've subscribed to.
 
 hasFeedUpdate ()
 Check if any newly received feed (Atom/RSS) update was received.
 
 getFeedUpdate ()
 Gets a newly received feed (Atom/RSS) sent by a Hub as an update to a Topic we've subscribed to.
 
- Public Member Functions inherited from AbstractCallback
 __construct ($options=null)
 Constructor; accepts an array or Traversable object to preset options for the Subscriber without calling all supported setter methods in turn.
 
 setOptions ($options)
 Process any injected configuration options.
 
 sendResponse ()
 Send the response, including all headers.
 
 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.
 
 setHttpResponse ($httpResponse)
 An instance of a class handling Http Responses.
 
 getHttpResponse ()
 An instance of a class handling Http Responses.
 
 setSubscriberCount ($count)
 Sets the number of Subscribers for which any updates are on behalf of.
 
 getSubscriberCount ()
 Gets the number of Subscribers for which any updates are on behalf of.
 

Protected Member Functions

 _hasValidVerifyToken (array $httpGetData=null, $checkValue=true)
 Check for a valid verify_token.
 
 _detectVerifyTokenKey (array $httpGetData=null)
 Attempt to detect the verification token key.
 
 _parseQueryString ()
 Build an array of Query String parameters.
 
- Protected Member Functions inherited from AbstractCallback
 _detectCallbackUrl ()
 Attempt to detect the callback URL (specifically the path forward)
 
 _getHttpHost ()
 Get the HTTP host.
 
 _getHeader ($header)
 Retrieve a Header value from either $_SERVER or Apache.
 
 _getRawBody ()
 Return the raw body of the request.
 

Protected Attributes

 $feedUpdate = null
 
 $subscriptionKey = null
 
 $currentSubscriptionData = null
 
- Protected Attributes inherited from AbstractCallback
 $storage = null
 
 $httpResponse = null
 
 $subscriberCount = 1
 

Member Function Documentation

_detectVerifyTokenKey ( array  $httpGetData = null)
protected

Attempt to detect the verification token key.

This would be passed in the Callback URL (which we are handling with this class!) as a URI path part (the last part by convention).

Parameters
null | array$httpGetData
Returns
false|string

Available when sub keys encoding in Callback URL path

Available only if allowed by PuSH 0.2 Hubs

Available (possibly) if corrupted in transit and not part of $_GET

_hasValidVerifyToken ( array  $httpGetData = null,
  $checkValue = true 
)
protected

Check for a valid verify_token.

By default attempts to compare values with that sent from Hub, otherwise merely ascertains its existence.

Parameters
array$httpGetData
bool$checkValue
Returns
bool
_parseQueryString ( )
protected

Build an array of Query String parameters.

This bypasses $_GET which munges parameter names and cannot accept multiple parameters with the same key.

Returns
array|void
getFeedUpdate ( )

Gets a newly received feed (Atom/RSS) sent by a Hub as an update to a Topic we've subscribed to.

Returns
string
handle ( array  $httpGetData = null,
  $sendResponseNow = false 
)

Handle any callback from a Hub Server responding to a subscription or unsubscription request.

This should be the Hub Server confirming the the request prior to taking action on it.

Parameters
array$httpGetDataGET data if available and not in $_GET
bool$sendResponseNowWhether to send response now or when asked
Returns
void

Handle any feed updates (sorry for the mess :P)

This DOES NOT attempt to process a feed update. Feed updates SHOULD be validated/processed by an asynchronous process so as to avoid holding up responses to the Hub.

Handle any (un)subscribe confirmation requests

Hey, C'mon! We tried everything else!

Implements CallbackInterface.

hasFeedUpdate ( )

Check if any newly received feed (Atom/RSS) update was received.

Returns
bool
isValidHubVerification ( array  $httpGetData)

Checks validity of the request simply by making a quick pass and confirming the presence of all REQUIRED parameters.

Parameters
array$httpGetData
Returns
bool

As per the specification, the hub.verify_token is OPTIONAL. This implementation of Pubsubhubbub considers it REQUIRED and will always send a hub.verify_token parameter to be echoed back by the Hub Server. Therefore, its absence is considered invalid.

Attempt to retrieve any Verification Token Key attached to Callback URL's path by our Subscriber implementation

setFeedUpdate (   $feed)

Sets a newly received feed (Atom/RSS) sent by a Hub as an update to a Topic we've subscribed to.

Parameters
string$feed
Returns
setSubscriptionKey (   $key)

Set a subscription key to use for the current callback request manually.

Required if usePathParameter is enabled for the Subscriber.

Parameters
string$key
Returns

Member Data Documentation

$currentSubscriptionData = null
protected
$feedUpdate = null
protected
$subscriptionKey = null
protected