1 | <?php |
||
17 | class Http |
||
18 | { |
||
19 | |||
20 | /** @var Factory */ |
||
21 | protected $factory; |
||
22 | |||
23 | /** |
||
24 | * Http constructor. |
||
25 | * |
||
26 | * @param Factory $factory |
||
27 | */ |
||
28 | 1 | public function __construct(Factory $factory) |
|
32 | |||
33 | /** |
||
34 | * Make a http query. |
||
35 | * |
||
36 | * @param string $url |
||
37 | * @param callable $callback |
||
38 | * @param null|mixed $additionalData If you need to pass additional metadata. |
||
39 | * You will get this back in the callback. |
||
40 | * @param array $options curl options array |
||
41 | */ |
||
42 | 1 | public function call($url, $callback, $additionalData = null, $options = []) |
|
49 | |||
50 | /** |
||
51 | * Make a get http query. |
||
52 | * |
||
53 | * @param string $url address |
||
54 | * @param callable $callback callback |
||
55 | * @param null|mixed $additionalData If you need to pass additional metadata. |
||
56 | * You will get this back in the callback. |
||
57 | * @param array $options Single dimensional array of curl_setopt key->values |
||
58 | */ |
||
59 | public function get($url, callable $callback, $additionalData = null, $options = []) |
||
72 | |||
73 | /** |
||
74 | * Make a post http query. |
||
75 | * |
||
76 | * @param string $url address |
||
77 | * @param string|array $fields |
||
78 | * @param callable $callback callback with returning datas |
||
79 | * @param null|mixed $additionalData If you need to pass additional metadata. |
||
80 | * You will get this back in the callback. |
||
81 | * @param array $options Single dimensional array of curl_setopt key->values |
||
82 | */ |
||
83 | public function post($url, $fields, callable $callback, $additionalData = null, $options = []) |
||
87 | |||
88 | /** |
||
89 | * Make a put http query. |
||
90 | * |
||
91 | * @param string $url address |
||
92 | * @param string|array $fields |
||
93 | * @param callable $callback callback with returning datas |
||
94 | * @param null|mixed $additionalData If you need to pass additional metadata. |
||
95 | * You will get this back in the callback. |
||
96 | * @param array $options Single dimensional array of curl_setopt key->values |
||
97 | */ |
||
98 | public function put($url, $fields, callable $callback, $additionalData = null, $options = []) |
||
102 | |||
103 | |||
104 | /** |
||
105 | * Make a delete http query. |
||
106 | * |
||
107 | * @param string $url address |
||
108 | * @param string|array $fields |
||
109 | * @param callable $callback callback with returning datas |
||
110 | * @param null|mixed $additionalData If you need to pass additional metadata. |
||
111 | * You will get this back in the callback. |
||
112 | * @param array $options Single dimensional array of curl_setopt key->values |
||
113 | */ |
||
114 | public function delete($url, $fields, callable $callback, $additionalData = null, $options = []) |
||
118 | |||
119 | /** |
||
120 | * processes the request return value |
||
121 | * @param HttpRequest $curl |
||
122 | */ |
||
123 | public function process(HttpRequest $curl) |
||
133 | |||
134 | protected function doCall($method, $url, $fields, callable $callback, $additionalData = null, $options = []) |
||
170 | } |
||
171 | |||
172 |