1 | <?php |
||
12 | class Client |
||
13 | { |
||
14 | /** |
||
15 | * API base uri |
||
16 | */ |
||
17 | const API_BASE_URI = 'https://api.wit.ai/'; |
||
18 | |||
19 | /* |
||
20 | * API Version |
||
21 | */ |
||
22 | const API_VERSION = '20160330'; |
||
23 | |||
24 | /** |
||
25 | * Request default timeout |
||
26 | */ |
||
27 | const DEFAULT_TIMEOUT = 5; |
||
28 | |||
29 | /** |
||
30 | * @var ClientInterface client |
||
31 | */ |
||
32 | private $client; |
||
33 | |||
34 | /** |
||
35 | * @var LoggerInterface |
||
36 | */ |
||
37 | private $logger; |
||
38 | |||
39 | /** |
||
40 | * @var ResponseInterface|null |
||
41 | */ |
||
42 | private $lastResponse; |
||
43 | |||
44 | /** |
||
45 | * @var string Wit app token |
||
46 | */ |
||
47 | private $accessToken; |
||
48 | |||
49 | 11 | public function __construct($accessToken, ClientInterface $httpClient = null, LoggerInterface $logger = null) |
|
59 | |||
60 | /** |
||
61 | * @param $uri |
||
62 | * @param array $params |
||
63 | * |
||
64 | * @return ResponseInterface |
||
65 | */ |
||
66 | 1 | public function post($uri, array $params = []) |
|
70 | |||
71 | /** |
||
72 | * @param $uri |
||
73 | * @param array $params |
||
74 | * |
||
75 | * @return ResponseInterface |
||
76 | */ |
||
77 | 1 | public function get($uri, array $params = []) |
|
81 | |||
82 | /** |
||
83 | * @param $uri |
||
84 | * @param array $params |
||
85 | * |
||
86 | * @return ResponseInterface |
||
87 | */ |
||
88 | 1 | public function put($uri, array $params = []) |
|
92 | |||
93 | /** |
||
94 | * @param $uri |
||
95 | * @param array $params |
||
|
|||
96 | * |
||
97 | * @return ResponseInterface |
||
98 | */ |
||
99 | 1 | public function delete($uri) |
|
103 | |||
104 | /** |
||
105 | * @param string $method |
||
106 | * @param string $uri |
||
107 | * @param array $queryParams |
||
108 | * @param mixed $postParams |
||
109 | * |
||
110 | * @return ResponseInterface |
||
111 | */ |
||
112 | 9 | public function send($method, $uri, array $queryParams = [], $postParams = null) |
|
130 | |||
131 | /** |
||
132 | * Get the last response from the API |
||
133 | * |
||
134 | * @return null|ResponseInterface |
||
135 | */ |
||
136 | 1 | public function getLastResponse() |
|
140 | |||
141 | 1 | public function getHttpClient() |
|
145 | |||
146 | /** |
||
147 | * Get the defaults headers like the Authorization field |
||
148 | * |
||
149 | * @return array |
||
150 | */ |
||
151 | 9 | private function getDefaultHeaders() |
|
159 | |||
160 | /** |
||
161 | * @param ResponseInterface $response |
||
162 | * |
||
163 | * @return bool |
||
164 | * |
||
165 | * @throws BadResponseException |
||
166 | */ |
||
167 | 9 | private function validateResponse(ResponseInterface $response) |
|
177 | } |
||
178 |
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.