PHP Class seregazhuk\PinterestBot\Api\ProvidersContainer

Inheritance: implements seregazhuk\PinterestBot\Contracts\ProvidersContainerInterface
Show file Open project: seregazhuk/php-pinterest-bot Class Usage Examples

Protected Properties

Property Type Description
$providers array A array containing the cached providers.
$request Request References to the request that travels through the application.
$response Response

Public Methods

Method Description
__construct ( Request $request, Response $response )
getClientInfo ( ) : array | null Simply proxies call to Response object.
getHttpClient ( ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient Returns HttpClient object for setting user-agent string or other CURL available options.
getLastError ( ) : string | null Proxies call to Request object and returns message from the error object.
getProvider ( string $provider ) : Provider Gets provider object by name. If there is no such provider in providers array, it will try to create it, then save it, and then return.

Protected Methods

Method Description
addProvider ( string $provider ) Creates provider by class name, and if success saves it to providers array. Provider class must exist in PROVIDERS_NAMESPACE.
buildProvider ( string $className ) : object Build Provider object with reflection API.
resolveProviderClass ( $provider ) : string

Method Details

__construct() public method

public __construct ( Request $request, Response $response )
$request Request
$response Response

addProvider() protected method

Creates provider by class name, and if success saves it to providers array. Provider class must exist in PROVIDERS_NAMESPACE.
protected addProvider ( string $provider )
$provider string

buildProvider() protected method

Build Provider object with reflection API.
protected buildProvider ( string $className ) : object
$className string
return object

getClientInfo() public method

Simply proxies call to Response object.
public getClientInfo ( ) : array | null
return array | null

getHttpClient() public method

Returns HttpClient object for setting user-agent string or other CURL available options.
public getHttpClient ( ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
return seregazhuk\PinterestBot\Api\Contracts\HttpClient

getLastError() public method

Proxies call to Request object and returns message from the error object.
public getLastError ( ) : string | null
return string | null

getProvider() public method

Gets provider object by name. If there is no such provider in providers array, it will try to create it, then save it, and then return.
public getProvider ( string $provider ) : Provider
$provider string
return seregazhuk\PinterestBot\Api\Providers\Provider

resolveProviderClass() protected method

protected resolveProviderClass ( $provider ) : string
$provider
return string

Property Details

$providers protected property

A array containing the cached providers.
protected array $providers
return array

$request protected property

References to the request that travels through the application.
protected Request,seregazhuk\PinterestBot\Api $request
return Request

$response protected property

protected Response,seregazhuk\PinterestBot\Api $response
return Response