| Total Complexity | 3 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Coverage | 70% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | abstract class AbstractClient |
||
| 13 | { |
||
| 14 | protected string $rawRequest = ''; |
||
| 15 | |||
| 16 | protected array $options = []; |
||
| 17 | |||
| 18 | abstract protected function authenticate(RequestInterface $request): RequestInterface; |
||
| 19 | |||
| 20 | abstract public function addHeader(string $name, string $value): void; |
||
| 21 | |||
| 22 | 6 | protected function sendRequest(RequestInterface $request): ResponseInterface |
|
| 23 | { |
||
| 24 | 6 | $request = $this->authenticate($request); |
|
| 25 | |||
| 26 | 6 | $response = $this->discoverClient()->sendRequest($request); |
|
| 27 | |||
| 28 | 6 | if ($request->getBody()->isSeekable()) { |
|
| 29 | 6 | $request->getBody()->rewind(); |
|
| 30 | } |
||
| 31 | 6 | $this->rawRequest = $request->getBody()->__toString(); |
|
| 32 | |||
| 33 | 6 | return $response; |
|
| 34 | } |
||
| 35 | |||
| 36 | protected function discoverClient(): ClientInterface |
||
| 41 | } |
||
| 42 | } |
||
| 43 |