BaseApi
in package
AbstractYes
Base class for API settings.
Table of Contents
Properties
- $apiKey : string|null
- $baseUrl : string
- $requestTimeout : int
- $urlRoot : string
Methods
- __construct() : mixed
- setApiKey() : void
- Sets the API key.
- setBaseUrl() : void
- Sets the base url.
- setFromEnv() : void
- Sets values from environment if needed.
- setTimeout() : void
- Sets the default timeout.
Properties
$apiKey
public
string|null
$apiKey
API key.
$baseUrl
public
string
$baseUrl
Base for the root url. Used for testing purposes.
$requestTimeout
public
int
$requestTimeout
Timeout for the request, in ms.
$urlRoot
public
string
$urlRoot
Root of the URL to use for API calls.
Methods
__construct()
public
__construct(string|null $apiKey) : mixed
Parameters
- $apiKey : string|null
-
API key.
setApiKey()
Sets the API key.
protected
setApiKey([string|null $apiKey = null ]) : void
Parameters
- $apiKey : string|null = null
-
Optional API key.
setBaseUrl()
Sets the base url.
protected
setBaseUrl(string $value) : void
Parameters
- $value : string
-
Value for the base Url.
setFromEnv()
Sets values from environment if needed.
protected
setFromEnv() : void
setTimeout()
Sets the default timeout.
protected
setTimeout(string $value) : void
Parameters
- $value : string
-
Value for the CURL timeout.