| Total Complexity | 4 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class CurlClient extends BaseClient |
||
| 10 | { |
||
| 11 | use Log; |
||
| 12 | |||
| 13 | public function request( |
||
| 14 | $method, |
||
| 15 | $url, |
||
| 16 | $params = [], |
||
| 17 | $data = [], |
||
| 18 | $headers = [], |
||
| 19 | $user = null, |
||
| 20 | $password = null, |
||
| 21 | $timeout = null |
||
| 22 | ) |
||
| 23 | { |
||
| 24 | $start = microtime(true); |
||
| 25 | |||
| 26 | /** @var Response $result */ |
||
| 27 | $result = parent::request($method, $url, $params, $data, $headers, $user, $password, $timeout); |
||
| 28 | |||
| 29 | if($this->hasLogger()) |
||
| 30 | { |
||
| 31 | $time = microtime(true) - $start; |
||
| 32 | |||
| 33 | $this->getLogger()->logCall( |
||
| 34 | $url, |
||
| 35 | '', |
||
| 36 | $method, |
||
| 37 | $time, |
||
| 38 | $this->fixHeaders($headers), |
||
| 39 | $data, |
||
| 40 | $result->getHeaders(), |
||
| 41 | json_encode($result->getContent()) |
||
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 45 | return $result; |
||
| 46 | } |
||
| 47 | |||
| 48 | private function fixHeaders($headers) |
||
| 58 | } |
||
| 59 | } |
||
| 60 |