| 1 | <?php |
||
| 14 | class CurlAdapter implements HttpInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Contains the curl instance |
||
| 18 | * |
||
| 19 | * @var resource |
||
| 20 | */ |
||
| 21 | private $curl; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Initializes curl resource |
||
| 25 | * |
||
| 26 | * @access public |
||
| 27 | * @param string $url |
||
| 28 | * |
||
| 29 | * @return $this |
||
| 30 | */ |
||
| 31 | protected function init($url) |
||
| 37 | |||
| 38 | |||
| 39 | /** |
||
| 40 | * Sets multiple options at the same time |
||
| 41 | * |
||
| 42 | * @access public |
||
| 43 | * @param array $options |
||
| 44 | * @return static |
||
| 45 | */ |
||
| 46 | protected function setOptions(array $options = []) |
||
| 52 | |||
| 53 | |||
| 54 | /** |
||
| 55 | * Check if the curl request ended up with errors |
||
| 56 | * |
||
| 57 | * @access public |
||
| 58 | * @return boolean |
||
| 59 | */ |
||
| 60 | public function hasErrors() |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Get curl errors |
||
| 67 | * |
||
| 68 | * @access public |
||
| 69 | * @return string |
||
| 70 | */ |
||
| 71 | public function getErrors() |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Close the curl resource |
||
| 78 | * |
||
| 79 | * @access public |
||
| 80 | * @return void |
||
| 81 | */ |
||
| 82 | protected function close() |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Executes curl request |
||
| 89 | * |
||
| 90 | * @param string $url |
||
| 91 | * @param array $options |
||
| 92 | * @return string |
||
| 93 | */ |
||
| 94 | public function execute($url, array $options = []) |
||
| 102 | } |
||
| 103 |