1 | <?php |
||
14 | trait HttpTrait |
||
15 | { |
||
16 | /** |
||
17 | * API host url |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $apiHost; |
||
22 | |||
23 | /** |
||
24 | * HTTP client |
||
25 | * |
||
26 | * @var \GuzzleHttp\Client |
||
27 | */ |
||
28 | protected $httpClient; |
||
29 | |||
30 | /** |
||
31 | * Prepares and appends parameters, if provided, to the given url. |
||
32 | * |
||
33 | * @param string $url |
||
34 | * @param array $parameters |
||
35 | * @param array $options |
||
36 | * |
||
37 | * @return string |
||
38 | */ |
||
39 | 16 | protected function appendParametersToUrl($url, array $parameters = array(), array $options = array()) |
|
53 | |||
54 | /** |
||
55 | * Returns the yelp client's http client to the given http client. Client. |
||
56 | * |
||
57 | * @return GuzzleHttp\Client|null |
||
58 | */ |
||
59 | 38 | public function getHttpClient() |
|
63 | |||
64 | /** |
||
65 | * Creates a PSR-7 Request instance. |
||
66 | * |
||
67 | * @param null|string $method HTTP method for the request. |
||
68 | * @param null|string $uri URI for the request. |
||
69 | * @param array $headers Headers for the message. |
||
70 | * @param string|resource|StreamInterface $body Message body. |
||
71 | * @param string $version HTTP protocol version. |
||
72 | * |
||
73 | * @return GuzzleHttp\Psr7\Request |
||
74 | */ |
||
75 | 18 | public function getRequest( |
|
94 | |||
95 | /** |
||
96 | * Sends a request instance and returns a response instance. |
||
97 | * |
||
98 | * WARNING: This method does not attempt to catch exceptions caused by HTTP |
||
99 | * errors! It is recommended to wrap this method in a try/catch block. |
||
100 | * |
||
101 | * @param RequestInterface $request |
||
102 | * @return ResponseInterface |
||
103 | * @throws Stevenmaguire\Yelp\Exception\HttpException |
||
104 | */ |
||
105 | 14 | public function getResponse(RequestInterface $request) |
|
115 | |||
116 | /** |
||
117 | * Updates query params array to apply yelp specific formatting rules. |
||
118 | * |
||
119 | * @param array $params |
||
120 | * @param array $options |
||
|
|||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | protected function prepareQueryParams($params = [], $csvParams = []) |
||
140 | |||
141 | /** |
||
142 | * Makes a request to the Yelp API and returns the response |
||
143 | * |
||
144 | * @param Psr\Http\Message\RequestInterface $request |
||
145 | * |
||
146 | * @return stdClass The JSON response from the request |
||
147 | * @throws Stevenmaguire\Yelp\Exception\ClientConfigurationException |
||
148 | * @throws Stevenmaguire\Yelp\Exception\HttpException |
||
149 | */ |
||
150 | 14 | protected function processRequest(RequestInterface $request) |
|
156 | |||
157 | /** |
||
158 | * Updates the yelp client's http client to the given http client. Client. |
||
159 | * |
||
160 | * @param GuzzleHttp\Client $client |
||
161 | * |
||
162 | * @return mixed |
||
163 | */ |
||
164 | 44 | public function setHttpClient(HttpClient $client) |
|
170 | } |
||
171 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.