PHP Class LeagueWrap\Api\AbstractApi

Inheritance: use trait LeagueWrap\Api\ConfigTrait
Datei anzeigen Open project: paquettg/leaguewrap Class Usage Examples

Protected Properties

Property Type Description
$api Provides access to the api object to perform requests on different api endpoints.
$cache LeagueWrap\CacheInterface This is the cache container that we intend to use.
$client LeagueWrap\ClientInterface The client used to communicate with the api.
$collection LeagueWrap\Limit\Collection The collection of limits to be used on this api.
$defaultRemember integer The amount of time we intend to remember the response for.
$key The key to be used by the api.
$permittedRegions A list of all permitted regions for this API call. Leave it empty to not lock out any region string.
$requests A count of the amount of API request this object has done so far.
$responseErrors List of http error response codes and associated erro message with each code.
$seconds integer The amount of seconds to keep things in cache
$version The version we want to use. If null use the first version in the array.

Public Methods

Method Description
__construct ( LeagueWrap\ClientInterface $client, LeagueWrap\Limit\Collection $collection, LeagueWrap\Api $api ) Default DI constructor.
getDomain ( ) : String
getRegion ( ) : Region
getRequestCount ( ) : integer Returns the amount of requests this object has done to the api so far.
remember ( integer $seconds = null, LeagueWrap\CacheInterface $cache = null ) Sets the amount of seconds we should remember the response for.
selectVersion ( string $version ) : boolean | $this Select the version of the api you wish to query.
setKey ( string $key ) Set the key to be used in the api.

Protected Methods

Method Description
attachResponse ( mixed $identity, mixed $response, string $key ) : boolean Attempts to attach the response to a summoner object.
attachResponses ( array | LeagueWrap\Dto\Summoner $identities, mixed $responses, string $key ) : boolean Attempts to attach all the responses to the correct summoner.
attachStaticDataToDto ( LeagueWrap\Dto\AbstractDto $dto ) : LeagueWrap\Dto\AbstractDto Will attempt to attach any static data to the given dto if the attach static data flag is set.
checkResponseErrors ( Response $response ) Checks the response for Http errors.
clientRequest ( boolean $static, string $uri, array $params ) : Response Make the actual request.
extractId ( LeagueWrap\Dto\Summoner | integer $identity ) : integer Attempts to extract an ID from the object/value given
extractIds ( mixed $identities ) : array Attempts to extract an ID from the array given.
getVersion ( ) : string Get the version string.
request ( string $path, array $params = [], boolean $static = false, boolean $isVersionized = true ) : mixed Wraps the request of the api in this method.

Method Details

__construct() public method

Default DI constructor.
public __construct ( LeagueWrap\ClientInterface $client, LeagueWrap\Limit\Collection $collection, LeagueWrap\Api $api )
$client LeagueWrap\ClientInterface
$collection LeagueWrap\Limit\Collection
$api LeagueWrap\Api

attachResponse() protected method

Attempts to attach the response to a summoner object.
protected attachResponse ( mixed $identity, mixed $response, string $key ) : boolean
$identity mixed
$response mixed
$key string
return boolean

attachResponses() protected method

Attempts to attach all the responses to the correct summoner.
protected attachResponses ( array | LeagueWrap\Dto\Summoner $identities, mixed $responses, string $key ) : boolean
$identities array | LeagueWrap\Dto\Summoner
$responses mixed
$key string
return boolean

attachStaticDataToDto() protected method

Will attempt to attach any static data to the given dto if the attach static data flag is set.
protected attachStaticDataToDto ( LeagueWrap\Dto\AbstractDto $dto ) : LeagueWrap\Dto\AbstractDto
$dto LeagueWrap\Dto\AbstractDto
return LeagueWrap\Dto\AbstractDto

checkResponseErrors() protected method

Checks the response for Http errors.
protected checkResponseErrors ( Response $response )
$response LeagueWrap\Response

clientRequest() protected method

Make the actual request.
protected clientRequest ( boolean $static, string $uri, array $params ) : Response
$static boolean
$uri string
$params array
return LeagueWrap\Response

extractId() protected method

Attempts to extract an ID from the object/value given
protected extractId ( LeagueWrap\Dto\Summoner | integer $identity ) : integer
$identity LeagueWrap\Dto\Summoner | integer
return integer

extractIds() protected method

Attempts to extract an ID from the array given.
protected extractIds ( mixed $identities ) : array
$identities mixed
return array

getDomain() abstract public method

abstract public getDomain ( ) : String
return String domain used for the request

getRegion() public method

public getRegion ( ) : Region
return LeagueWrap\Region region of this api

getRequestCount() public method

Returns the amount of requests this object has done to the api so far.
public getRequestCount ( ) : integer
return integer

getVersion() protected method

Get the version string.
protected getVersion ( ) : string
return string

remember() public method

Leave it empty (or null) if you want to use the default set for each api request.
public remember ( integer $seconds = null, LeagueWrap\CacheInterface $cache = null )
$seconds integer
$cache LeagueWrap\CacheInterface

request() protected method

Wraps the request of the api in this method.
protected request ( string $path, array $params = [], boolean $static = false, boolean $isVersionized = true ) : mixed
$path string
$params array
$static boolean
$isVersionized boolean
return mixed

selectVersion() public method

Select the version of the api you wish to query.
public selectVersion ( string $version ) : boolean | $this
$version string
return boolean | $this

setKey() public method

Set the key to be used in the api.
public setKey ( string $key )
$key string

Property Details

$api protected_oe property

Provides access to the api object to perform requests on different api endpoints.
protected $api

$cache protected_oe property

This is the cache container that we intend to use.
protected CacheInterface,LeagueWrap $cache
return LeagueWrap\CacheInterface

$client protected_oe property

The client used to communicate with the api.
protected ClientInterface,LeagueWrap $client
return LeagueWrap\ClientInterface

$collection protected_oe property

The collection of limits to be used on this api.
protected Collection,LeagueWrap\Limit $collection
return LeagueWrap\Limit\Collection

$defaultRemember protected_oe property

The amount of time we intend to remember the response for.
protected int $defaultRemember
return integer

$key protected_oe property

The key to be used by the api.
protected $key

$permittedRegions protected_oe property

A list of all permitted regions for this API call. Leave it empty to not lock out any region string.
protected $permittedRegions

$requests protected_oe property

A count of the amount of API request this object has done so far.
protected $requests

$responseErrors protected_oe property

List of http error response codes and associated erro message with each code.
protected $responseErrors

$seconds protected_oe property

The amount of seconds to keep things in cache
protected int $seconds
return integer

$version protected_oe property

The version we want to use. If null use the first version in the array.
protected $version