| 1 | <?php | ||
| 5 | abstract class Adapter | ||
| 6 | { | ||
| 7 | /** | ||
| 8 | * Params used to initialise this instance, e.g. authentication parameters for the Digital Ocean API. | ||
| 9 | */ | ||
| 10 | protected $params; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * The http client that will manage API requests and handle responses. | ||
| 14 | */ | ||
| 15 | protected $client; | ||
| 16 | |||
| 17 | /** | ||
| 18 | * The headers to proceed the API request in order to authenticate it. | ||
| 19 | */ | ||
| 20 | protected $headers; | ||
| 21 | |||
| 22 | /** | ||
| 23 | * Constructor. Receive and record parameters. Use them to set request headers. | ||
| 24 | * | ||
| 25 | * @param array $params | ||
| 26 | */ | ||
| 27 | public function __construct($params) | ||
| 33 | |||
| 34 | /** | ||
| 35 | * Set the client class var. | ||
| 36 | * | ||
| 37 | * @param GuzzleHttp\Client $client | ||
| 38 | * @return void | ||
| 39 | */ | ||
| 40 | public function setClient($client) | ||
| 44 | |||
| 45 | /** | ||
| 46 | * Construct http client request headers. | ||
| 47 | * | ||
| 48 | * @return void | ||
| 49 | */ | ||
| 50 | protected function setHeaders() | ||
| 54 | |||
| 55 | /** | ||
| 56 | * Get headers for https client. | ||
| 57 | * | ||
| 58 | * @return array | ||
| 59 | */ | ||
| 60 | public function getHeaders() | ||
| 64 | } | ||
| 65 |