4 declare(strict_types=1);
13 use GuzzleHttp\ClientInterface;
26 if (defined(
'\GuzzleHttp\ClientInterface::MAJOR_VERSION')) {
27 $clientVersion = (string) constant(ClientInterface::class .
'::MAJOR_VERSION');
29 $clientVersion = (string) constant(ClientInterface::class .
'::VERSION');
32 $userAgent = self::USER_AGENT . $this->getPackageVersion();
34 $userAgent .=
' (GuzzleHttp/' . $clientVersion;
35 if (extension_loaded(
'curl') && function_exists(
'curl_version')) {
36 $userAgent .=
'; curl/' . (string) \curl_version()[
'version'];
38 $userAgent .=
') PHP/' . PHP_VERSION;
39 if (!is_null($suffix)) {
40 $userAgent .=
' ' . $suffix;
42 $this->userAgent = $userAgent;
45 private function getPackageVersion(): string
47 if (class_exists(
"\Commercetools\Client\PackageVersion")) {
49 if ($version !=
null) {
50 return "/" . $version;
58 return $this->userAgent;