class HubtelHandler (View source)

Hubtel Handler Class

This class holds the hubtel handler and can be used with any Guzzle client to queue requests and middlewares.

Properties

protected HandlerStack $stack Property for holding the handler stack on the instance
protected Config $config Holds the configuration object

Methods

__construct(Config $config, HandlerStack $stack = null)

Constructor for the HubtelHandler class

HandlerStack
createHandler()

Create the client handler.

HandlerStack
pushHeaderMiddleware(callable $header)

Push the Header Middleware to the Handler Stack

HandlerStack
pushBasicAuthMiddleware(callable $header)

Push the Header Middleware to the Handler Stack containing the bacic authentication in base64

HandlerStack
pushRetryMiddleware(callable $decider, callable $delay = null)

Pushes a Retry Middleware to the Guzzle Client Handler Stack.

static callable
decider()

Function $decider callable

static 
delay()

Function $delay

Details

__construct(Config $config, HandlerStack $stack = null)

Constructor for the HubtelHandler class

Parameters

Config $config
HandlerStack $stack

HandlerStack createHandler()

Create the client handler.

Return Value

HandlerStack

See also

http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html Guzzle: Handlers and Middlewares.

protected HandlerStack pushHeaderMiddleware(callable $header)

Push the Header Middleware to the Handler Stack

Parameters

callable $header Function that accepts a Guzzle RequestInterface and returns a RequestInterface.

Return Value

HandlerStack

See also

http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html Guzzle: Handlers and Middlewares.

protected HandlerStack pushBasicAuthMiddleware(callable $header)

Push the Header Middleware to the Handler Stack containing the bacic authentication in base64

Parameters

callable $header Function that accepts a Guzzle RequestInterface and returns a RequestInterface.

Return Value

HandlerStack

See also

http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html Guzzle: Handlers and Middlewares.

protected HandlerStack pushRetryMiddleware(callable $decider, callable $delay = null)

Pushes a Retry Middleware to the Guzzle Client Handler Stack.

Middleware that retries requests based on the boolean result of invoking the provided "decider" function.

If no delay function is provided, a simple implementation of exponential backoff will be utilized.

Parameters

callable $decider Function that accepts the number of retries, a request, [response], and [exception] and returns true if the request is to be retried.
callable $delay Function that accepts the number of retries and returns the number of milliseconds to delay.

Return Value

HandlerStack

See also

http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html Guzzle: Handlers and Middlewares.

static protected callable decider()

Function $decider callable

Retuens a function that accepts the number of retries, a request, [response], and [exception] and returns true if the request is to be retried.

Return Value

callable $decider

See also

http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html Guzzle: Handlers and Middlewares.

static protected delay()

Function $delay

returns a Function that accepts the number of retries and returns the number of milliseconds to delay.

The function is passed to the Retry Middleware as the second arguement and then pushed into the handler stack.

See also

http://docs.guzzlephp.org/en/stable/handlers-and-middleware.html Guzzle: Handlers and Middlewares.