class BaseClient

Abstract client for common code for the different clients.

Methods

__construct(string $accessToken, string $host, LoggerInterface $logger = \null, Client $httpClient = \null)

Client constructor.

$this
setApplication(string|null $name, string|null $version = \null)

Set the application name and version. The values are used as part of the X-Contentful-User-Agent header.

$this
setIntegration(string|null $name, string|null $version = \null)

Set the integration name and version. The values are used as part of the X-Contentful-User-Agent header.

array|null
request(string $method, string $path, array $options = [])

No description

string|null
getExceptionNamespace()

Override this method for registering a custom namespace where the Client will look for an exception. If no exception is found in the custom namespace, the default namespace will be used.

LoggerInterface
getLogger()

No description

getMessages()

No description

string
getHost()

No description

string
getApi()

Returns a string representation of the API currently in use.

string
getSdkName()

The name of the library to be used in the User-Agent header.

string
getSdkVersion()

The version of the library to be used in the User-Agent header.

string
getApiContentType()

Returns the Content-Type (MIME-Type) to be used when communication with the API.

Details

at line 62
__construct(string $accessToken, string $host, LoggerInterface $logger = \null, Client $httpClient = \null)

Client constructor.

Parameters

string $accessToken
string $host
LoggerInterface $logger
Client $httpClient

at line 92
$this setApplication(string|null $name, string|null $version = \null)

Set the application name and version. The values are used as part of the X-Contentful-User-Agent header.

Parameters

string|null $name
string|null $version

Return Value

$this

at line 107
$this setIntegration(string|null $name, string|null $version = \null)

Set the integration name and version. The values are used as part of the X-Contentful-User-Agent header.

Parameters

string|null $name
string|null $version

Return Value

$this

at line 127
protected array|null request(string $method, string $path, array $options = [])

Parameters

string $method The HTTP method
string $path The URI path
array $options An array of optional parameters. The following keys are accepted: * query An array of query parameters that will be appended to the URI * headers An array of headers that will be added to the request * body The request body * baseUri A string that can be used to override the default client base URI

Return Value

array|null

Exceptions

Exception

at line 248
protected string|null getExceptionNamespace()

Override this method for registering a custom namespace where the Client will look for an exception. If no exception is found in the custom namespace, the default namespace will be used.

Return Value

string|null

at line 256
LoggerInterface getLogger()

Return Value

LoggerInterface

at line 264
Message[] getMessages()

Return Value

Message[]

at line 272
string getHost()

Return Value

string

at line 282
abstract string getApi()

Returns a string representation of the API currently in use.

Return Value

string

at line 289
abstract protected string getSdkName()

The name of the library to be used in the User-Agent header.

Return Value

string

at line 296
abstract protected string getSdkVersion()

The version of the library to be used in the User-Agent header.

Return Value

string

at line 303
abstract protected string getApiContentType()

Returns the Content-Type (MIME-Type) to be used when communication with the API.

Return Value

string