1 | <?php |
||
20 | class Request{ |
||
21 | |||
22 | /** |
||
23 | * The cURL connection |
||
24 | * |
||
25 | * @var resource |
||
26 | */ |
||
27 | protected $curl; |
||
28 | |||
29 | /** |
||
30 | * @var \chillerlan\TinyCurl\RequestOptions |
||
31 | */ |
||
32 | protected $options; |
||
33 | |||
34 | /** |
||
35 | * Request constructor. |
||
36 | * |
||
37 | * @param \chillerlan\Traits\ContainerInterface $options |
||
|
|||
38 | */ |
||
39 | public function __construct(ContainerInterface $options = null){ |
||
40 | $this->setOptions($options ?: new RequestOptions); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @param \chillerlan\Traits\ContainerInterface $options |
||
45 | * |
||
46 | * @return \chillerlan\TinyCurl\Request |
||
47 | */ |
||
48 | public function setOptions(ContainerInterface $options):Request { |
||
49 | $this->options = $options; |
||
50 | |||
51 | return $this; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return \chillerlan\Traits\ContainerInterface |
||
56 | */ |
||
57 | public function getOptions():ContainerInterface{ |
||
60 | |||
61 | /** |
||
62 | * @param string $url |
||
63 | * |
||
64 | * @return \chillerlan\TinyCurl\ResponseInterface |
||
65 | */ |
||
66 | protected function getResponse(string $url):ResponseInterface { |
||
67 | curl_setopt($this->curl, CURLOPT_URL, $url); |
||
68 | |||
69 | return new Response($this->curl); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @return void |
||
74 | */ |
||
75 | protected function initCurl(){ |
||
91 | |||
92 | /** |
||
93 | * @param \chillerlan\TinyCurl\URL $url |
||
94 | * @param array|null $curl_options |
||
95 | * |
||
96 | * @return \chillerlan\TinyCurl\ResponseInterface |
||
97 | */ |
||
98 | public function fetch(URL $url, array $curl_options = []):ResponseInterface { |
||
141 | |||
142 | /** |
||
143 | * @param array $headers |
||
144 | * |
||
145 | * @return array |
||
146 | */ |
||
147 | public function normalizeHeaders(array $headers):array { |
||
171 | |||
172 | /** |
||
173 | * @param string $url |
||
174 | * |
||
175 | * @return array<string> |
||
176 | */ |
||
177 | public function extractShortUrl(string $url):array { |
||
186 | |||
187 | /** |
||
188 | * @param string $url |
||
189 | * |
||
190 | * @return string |
||
191 | * @link http://www.internoetics.com/2012/11/12/resolve-short-urls-to-their-destination-url-php-api/ |
||
192 | */ |
||
193 | protected function extract(string $url):string { |
||
220 | |||
221 | } |
||
222 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.