| 1 | <?php |
||
| 18 | abstract class AbstractApi |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | protected $endpoint = 'https://api.vultr.com/v1'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var AdapterInterface |
||
| 27 | */ |
||
| 28 | protected $adapter; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var Meta |
||
| 32 | */ |
||
| 33 | protected $meta; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param AdapterInterface $adapter |
||
| 37 | */ |
||
| 38 | public function __construct(AdapterInterface $adapter) |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Bind response to Entity. |
||
| 45 | * |
||
| 46 | * Decode API response and bind the response to the respective entity |
||
| 47 | * |
||
| 48 | * @param string $response the response from the API |
||
| 49 | * @param string $class Entity to bind the response to |
||
| 50 | * @param bool $isArray If the response is a collection |
||
| 51 | * |
||
| 52 | * @return object Entity instance |
||
| 53 | **/ |
||
| 54 | protected function handleResponse($response, $class, $isArray = false) |
||
| 65 | } |
||
| 66 |