PHP Class LeagueWrap\Api\AbstractApi

Inheritance: use trait LeagueWrap\Api\ConfigTrait
Afficher le fichier Open project: paquettg/leaguewrap Class Usage Examples

Protected Properties

Свойство 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.

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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 méthode

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

attachResponses() protected méthode

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
Résultat boolean

attachStaticDataToDto() protected méthode

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
Résultat LeagueWrap\Dto\AbstractDto

checkResponseErrors() protected méthode

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

clientRequest() protected méthode

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

extractId() protected méthode

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

extractIds() protected méthode

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

getDomain() abstract public méthode

abstract public getDomain ( ) : String
Résultat String domain used for the request

getRegion() public méthode

public getRegion ( ) : Region
Résultat LeagueWrap\Region region of this api

getRequestCount() public méthode

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

getVersion() protected méthode

Get the version string.
protected getVersion ( ) : string
Résultat string

remember() public méthode

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 méthode

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
Résultat mixed

selectVersion() public méthode

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

setKey() public méthode

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
Résultat LeagueWrap\CacheInterface

$client protected_oe property

The client used to communicate with the api.
protected ClientInterface,LeagueWrap $client
Résultat LeagueWrap\ClientInterface

$collection protected_oe property

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

$defaultRemember protected_oe property

The amount of time we intend to remember the response for.
protected int $defaultRemember
Résultat 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
Résultat integer

$version protected_oe property

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