public static function LockrClient::createFromSettings in Lockr 7.3
Parameters
SettingsInterface $settings:
1 call to LockrClient::createFromSettings()
- lockr_client in ./
lockr.module - Returns the Lockr client for this site.
File
- vendor/
lockr/ lockr/ src/ LockrClient.php, line 67
Class
Namespace
LockrCode
public static function createFromSettings(SettingsInterface $settings) {
$ua = 'php/' . phpversion() . ' LockrClient/' . self::VERSION;
$base_options = [
'base_uri' => "https://{$settings->getHostname()}",
'connect_timeout' => 2.0,
'expect' => false,
'headers' => [
'accept' => [
'application/json',
],
'user-agent' => [
$ua,
],
],
'http_errors' => false,
'read_timeout' => 3.0,
'timeout' => 5.0,
];
$options = array_replace($base_options, $settings
->getOptions());
$client = new GuzzleHttp\Client($options);
return new static($client);
}