9 namespace Fossology\Lib\Util;
11 use GuzzleHttp\Client;
22 public static function getGuzzleClient(array $SysConf,
string $baseUri,
string $token =
"")
25 if (array_key_exists(
'http_proxy', $SysConf[
'FOSSOLOGY']) &&
26 !empty($SysConf[
'FOSSOLOGY'][
'http_proxy'])) {
27 $proxy[
'http'] = $SysConf[
'FOSSOLOGY'][
'http_proxy'];
29 if (array_key_exists(
'https_proxy', $SysConf[
'FOSSOLOGY']) &&
30 !empty($SysConf[
'FOSSOLOGY'][
'https_proxy'])) {
31 $proxy[
'https'] = $SysConf[
'FOSSOLOGY'][
'https_proxy'];
33 if (array_key_exists(
'no_proxy', $SysConf[
'FOSSOLOGY']) &&
34 !empty($SysConf[
'FOSSOLOGY'][
'no_proxy'])) {
35 $proxy[
'no'] = explode(
',', $SysConf[
'FOSSOLOGY'][
'no_proxy']);
38 $version = $SysConf[
'BUILD'][
'VERSION'];
39 $headers = [
'User-Agent' =>
"fossology/$version"];
41 $headers[
'Authorization'] =
'Bearer ' . $token;
45 'http_errors' =>
false,
47 'base_uri' => $baseUri,
static getGuzzleClient(array $SysConf, string $baseUri, string $token="")