| 1 | <?php |
||
| 10 | class CurlClient |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var resource cURL handle |
||
| 14 | */ |
||
| 15 | private $resource; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var int |
||
| 19 | */ |
||
| 20 | private $response; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Constructor. |
||
| 24 | * |
||
| 25 | * @param string $url |
||
| 26 | * @param array $options |
||
| 27 | * @return self |
||
|
|
|||
| 28 | */ |
||
| 29 | public function __construct($url, array $options = []) |
||
| 39 | |||
| 40 | //------------------------------------------------------------------------- |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Add an option. |
||
| 44 | * |
||
| 45 | * @param string $key |
||
| 46 | * @param string $value |
||
| 47 | * @return $this |
||
| 48 | */ |
||
| 49 | public function addOption($key, $value) |
||
| 55 | |||
| 56 | //------------------------------------------------------------------------- |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Get the response |
||
| 60 | * |
||
| 61 | * @param void |
||
| 62 | * @return int |
||
| 63 | * @throws \RuntimeException On cURL error |
||
| 64 | */ |
||
| 65 | public function hit() |
||
| 92 | } |
||
| 93 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.