Conditions | 3 |
Paths | 4 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
59 | private function httpClientInitialize($endpoint = null, Client $client = null) |
||
60 | { |
||
61 | $this->endpoint = $endpoint; |
||
62 | $this->client = $client; |
||
63 | |||
64 | if(is_null($this->client)) |
||
65 | $this->client = new Client(); |
||
66 | |||
67 | $this->headers['x-application-key'] = $this->client->getParameter( |
||
68 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TOKEN); |
||
69 | |||
70 | $baseUrl = $this->client->getParameter( |
||
71 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_HOST); |
||
72 | |||
73 | if(!empty($endpoint)) |
||
74 | $baseUrl = sprintf("%s%s/", $baseUrl, $endpoint); |
||
75 | |||
76 | $this->httpClient = new GuzzleHttp\Client([ |
||
77 | 'base_url' => $baseUrl, |
||
78 | 'timeout' => $this->client->getParameter( |
||
79 | PayGoTransactionParameterConst::PAYGO_TRANSACTIONS_TIMEOUT), |
||
80 | 'verify' => false, |
||
81 | 'defaults' => [ |
||
82 | 'headers' => $this->headers, |
||
83 | 'exceptions' => false, |
||
84 | ] |
||
85 | ]); |
||
86 | } |
||
87 | |||
88 | } |