1 | <?php |
||
7 | class NpmSearch |
||
8 | { |
||
9 | |||
10 | /** @var Client */ |
||
11 | public $guzzleClient; |
||
12 | |||
13 | /** @var string */ |
||
14 | public $baseUrl; |
||
15 | |||
16 | /** |
||
17 | * @param Client $client |
||
|
|||
18 | * @param string $baseUrl |
||
19 | */ |
||
20 | public function __construct($baseUrl = 'https://npmsearch.com/query', Client $guzzleClient = null) |
||
28 | |||
29 | /** |
||
30 | * Search package using a query |
||
31 | * |
||
32 | * @param string $query Search query |
||
33 | * @param integer $start Start from |
||
34 | * @param integer $rows Number of rows |
||
35 | * @return array |
||
36 | */ |
||
37 | public function search(string $query, int $start = 0, int $rows = 10):array |
||
46 | |||
47 | /** |
||
48 | * Search package using author |
||
49 | * |
||
50 | * @param string $author Author |
||
51 | * @param integer $start Start form |
||
52 | * @param integer $rows Number of rows |
||
53 | * @return array |
||
54 | */ |
||
55 | public function searchUsingAuthor(string $author, int $start = 0, int $rows = 10):array |
||
64 | |||
65 | /** |
||
66 | * Search package using create data |
||
67 | * |
||
68 | * @param string $created Created date |
||
69 | * @param integer $start Start form |
||
70 | * @param integer $rows Number of rows |
||
71 | * @return array |
||
72 | */ |
||
73 | public function searchUsingCreated(string $created, int $start = 0, int $rows = 10):array |
||
82 | |||
83 | /** |
||
84 | * Search package using dependencies |
||
85 | * |
||
86 | * @param string $dependencies Dependencies |
||
87 | * @param integer $start Start form |
||
88 | * @param integer $rows Number of rows |
||
89 | * @return array |
||
90 | */ |
||
91 | public function searchUsingDependencies(string $dependencies, int $start = 0, int $rows = 10):array |
||
99 | |||
100 | /** |
||
101 | * Search package using description |
||
102 | * |
||
103 | * @param string $description Description |
||
104 | * @param integer $start Start form |
||
105 | * @param integer $rows Number of rows |
||
106 | * @return array |
||
107 | */ |
||
108 | public function searchUsingDescription(string $description, int $start = 0, int $rows = 10):array |
||
116 | |||
117 | /** |
||
118 | * Search package using devDependencies |
||
119 | * |
||
120 | * @param string $devDependencies DevDependencies |
||
121 | * @param integer $start Start form |
||
122 | * @param integer $rows Number of rows |
||
123 | * @return array |
||
124 | */ |
||
125 | public function searchUsingDevDependencies(string $devDependencies, int $start = 0, int $rows = 10):array |
||
133 | |||
134 | /** |
||
135 | * Search package using homepage |
||
136 | * |
||
137 | * @param string $homepage Homepage |
||
138 | * @param integer $start Start form |
||
139 | * @param integer $rows Number of rows |
||
140 | * @return array |
||
141 | */ |
||
142 | public function searchUsingHomepage(string $homepage, int $start = 0, int $rows = 10):array |
||
150 | |||
151 | /** |
||
152 | * Search package using keywords |
||
153 | * |
||
154 | * @param string $keywords Keywords |
||
155 | * @param integer $start Start form |
||
156 | * @param integer $rows Number of rows |
||
157 | * @return array |
||
158 | */ |
||
159 | public function searchUsingKeywords(string $keywords, int $start = 0, int $rows = 10):array |
||
167 | |||
168 | /** |
||
169 | * Search package using maintainers |
||
170 | * |
||
171 | * @param string $maintainers Maintainers |
||
172 | * @param integer $start Start form |
||
173 | * @param integer $rows Number of rows |
||
174 | * @return array |
||
175 | */ |
||
176 | public function searchUsingMaintainers(string $maintainers, int $start = 0, int $rows = 10):array |
||
184 | |||
185 | /** |
||
186 | * Search package using modified date |
||
187 | * |
||
188 | * @param string $modified Modified date |
||
189 | * @param integer $start Start form |
||
190 | * @param integer $rows Number of rows |
||
191 | * @return array |
||
192 | */ |
||
193 | public function searchUsingModified(string $modified, int $start = 0, int $rows = 10):array |
||
201 | |||
202 | /** |
||
203 | * Search package using name |
||
204 | * |
||
205 | * @param string $name Name |
||
206 | * @param integer $start Start form |
||
207 | * @param integer $rows Number of rows |
||
208 | * @return array |
||
209 | */ |
||
210 | public function searchUsingName(string $name, int $start = 0, int $rows = 10):array |
||
218 | |||
219 | /** |
||
220 | * Search package using readme |
||
221 | * |
||
222 | * @param string $readme Readme |
||
223 | * @param integer $start Start form |
||
224 | * @param integer $rows Number of rows |
||
225 | * @return array |
||
226 | */ |
||
227 | public function searchUsingReadme(string $readme, int $start = 0, int $rows = 10):array |
||
235 | |||
236 | /** |
||
237 | * Search package using repository |
||
238 | * |
||
239 | * @param string $repository Repository |
||
240 | * @param integer $start Start form |
||
241 | * @param integer $rows Number of rows |
||
242 | * @return array |
||
243 | */ |
||
244 | public function searchUsingRepository(string $repository, int $start = 0, int $rows = 10):array |
||
252 | |||
253 | /** |
||
254 | * Search package using scripts |
||
255 | * |
||
256 | * @param string $scripts Scripts |
||
257 | * @param integer $start Start form |
||
258 | * @param integer $rows Number of rows |
||
259 | * @return array |
||
260 | */ |
||
261 | public function searchUsingScripts(string $scripts, int $start = 0, int $rows = 10):array |
||
269 | |||
270 | /** |
||
271 | * Search package using times |
||
272 | * |
||
273 | * @param string $times Times |
||
274 | * @param integer $start Start form |
||
275 | * @param integer $rows Number of rows |
||
276 | * @return array |
||
277 | */ |
||
278 | public function searchUsingTimes(string $times, int $start = 0, int $rows = 10):array |
||
286 | |||
287 | /** |
||
288 | * Search package using version |
||
289 | * |
||
290 | * @param string $version Version |
||
291 | * @param integer $start Start form |
||
292 | * @param integer $rows Number of rows |
||
293 | * @return array |
||
294 | */ |
||
295 | public function searchUsingVersion(string $version, int $start = 0, int $rows = 10):array |
||
303 | |||
304 | /** |
||
305 | * Search package using rating |
||
306 | * |
||
307 | * @param string $rating Rating |
||
308 | * @param integer $start Start form |
||
309 | * @param integer $rows Number of rows |
||
310 | * @return array |
||
311 | */ |
||
312 | public function searchUsingRating(string $rating, int $start = 0, int $rows = 10):array |
||
320 | |||
321 | /** |
||
322 | * @param array $query |
||
323 | * |
||
324 | * @return array |
||
325 | */ |
||
326 | private function makeRequest($query = []):array |
||
334 | } |
||
335 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.