Total Complexity | 7 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 93.75% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | class UserAgentProvider |
||
9 | { |
||
10 | private $userAgent; |
||
11 | |||
12 | /** |
||
13 | * UserAgentProvider constructor. |
||
14 | * @param string $userAgent |
||
15 | */ |
||
16 | 27 | public function __construct($userAgent = null) |
|
17 | { |
||
18 | 27 | if (is_null($userAgent)) { |
|
19 | 27 | $userAgent = 'commercetools-php-sdk/' . Client::VERSION; |
|
20 | |||
21 | 27 | $userAgent .= ' (' . $this->getAdapterInfo(); |
|
22 | 27 | if (extension_loaded('curl') && function_exists('curl_version')) { |
|
23 | 27 | $userAgent .= '; curl/' . \curl_version()['version']; |
|
24 | } |
||
25 | 27 | $userAgent .= ') PHP/' . PHP_VERSION; |
|
26 | } |
||
27 | 27 | $this->userAgent = $userAgent; |
|
28 | 27 | } |
|
29 | |||
30 | /** |
||
31 | * @return string |
||
32 | */ |
||
33 | 27 | public function getUserAgent() |
|
36 | } |
||
37 | |||
38 | 27 | private function getAdapterInfo() |
|
48 |