@@ -371,28 +371,28 @@ |
||
371 | 371 | public function endpointParameters(string $endpoint, string $subset): array |
372 | 372 | { |
373 | 373 | static $projectParameters = [ |
374 | - 'contributors' => ['format' => ':platform/:name/contributors' , 'options' => ['platform', 'name']], |
|
375 | - 'dependencies' => ['format' => ':platform/:name/:version/dependencies' , 'options' => ['platform', 'name', 'version']], |
|
374 | + 'contributors' => ['format' => ':platform/:name/contributors', 'options' => ['platform', 'name']], |
|
375 | + 'dependencies' => ['format' => ':platform/:name/:version/dependencies', 'options' => ['platform', 'name', 'version']], |
|
376 | 376 | 'dependent_repositories' => ['format' => ':platform/:name/dependent_repositories', 'options' => ['platform', 'name']], |
377 | - 'dependents' => ['format' => ':platform/:name/dependents' , 'options' => ['platform', 'name']], |
|
378 | - 'search' => ['format' => 'search' , 'options' => ['query', 'sort']], |
|
379 | - 'sourcerank' => ['format' => ':platform/:name/sourcerank' , 'options' => ['platform', 'name']], |
|
380 | - 'project' => ['format' => ':platform/:name' , 'options' => ['platform', 'name']] |
|
377 | + 'dependents' => ['format' => ':platform/:name/dependents', 'options' => ['platform', 'name']], |
|
378 | + 'search' => ['format' => 'search', 'options' => ['query', 'sort']], |
|
379 | + 'sourcerank' => ['format' => ':platform/:name/sourcerank', 'options' => ['platform', 'name']], |
|
380 | + 'project' => ['format' => ':platform/:name', 'options' => ['platform', 'name']] |
|
381 | 381 | ]; |
382 | 382 | |
383 | 383 | static $repositoryParameters = [ |
384 | 384 | 'dependencies' => ['format' => 'github/:owner/:name/dependencies', 'options' => ['owner', 'name']], |
385 | - 'projects' => ['format' => 'github/:owner/:name/projects' , 'options' => ['owner', 'name']], |
|
386 | - 'repository' => ['format' => 'github/:owner/:name' , 'options' => ['owner', 'name']] |
|
385 | + 'projects' => ['format' => 'github/:owner/:name/projects', 'options' => ['owner', 'name']], |
|
386 | + 'repository' => ['format' => 'github/:owner/:name', 'options' => ['owner', 'name']] |
|
387 | 387 | ]; |
388 | 388 | |
389 | 389 | static $userParameters = [ |
390 | - 'dependencies' => ['format' => 'github/:login/dependencies' , 'options' => ['login']], |
|
391 | - 'package_contributions' => ['format' => 'github/:login/project-contributions' , 'options' => ['login']], |
|
392 | - 'packages' => ['format' => 'github/:login/projects' , 'options' => ['login']], |
|
393 | - 'repositories' => ['format' => 'github/:login/repositories' , 'options' => ['login']], |
|
390 | + 'dependencies' => ['format' => 'github/:login/dependencies', 'options' => ['login']], |
|
391 | + 'package_contributions' => ['format' => 'github/:login/project-contributions', 'options' => ['login']], |
|
392 | + 'packages' => ['format' => 'github/:login/projects', 'options' => ['login']], |
|
393 | + 'repositories' => ['format' => 'github/:login/repositories', 'options' => ['login']], |
|
394 | 394 | 'repository_contributions' => ['format' => 'github/:login/repository-contributions', 'options' => ['login']], |
395 | - 'subscriptions' => ['format' => 'subscriptions' , 'options' => []] |
|
395 | + 'subscriptions' => ['format' => 'subscriptions', 'options' => []] |
|
396 | 396 | ]; |
397 | 397 | |
398 | 398 | return match($endpoint) { |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | return $format; |
418 | 418 | } |
419 | 419 | |
420 | - foreach ($options AS $key => $val) { |
|
420 | + foreach ($options as $key => $val) { |
|
421 | 421 | if ($key === 'page' || $key === 'per_page') { |
422 | 422 | continue; |
423 | 423 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | { |
440 | 440 | $noError = true; |
441 | 441 | |
442 | - foreach ($endpointOptions AS $endpointOption) { |
|
442 | + foreach ($endpointOptions as $endpointOption) { |
|
443 | 443 | if (!isset($options[$endpointOption])) { |
444 | 444 | $noError = false; |
445 | 445 | break; |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | { |
191 | 191 | return [ |
192 | 192 | //contributors, dependencies, dependent_repositories, dependents, search, sourcerank, or project |
193 | - ['{"Hello":"World"}', 'contributors' , ['platform' => 'npm' , 'name' => 'utility']], |
|
194 | - ['{"Hello":"World"}', 'dependencies' , ['platform' => 'npm' , 'name' => 'utility', 'version' => 'latest']], |
|
195 | - ['{"Hello":"World"}', 'dependent_repositories', ['platform' => 'npm' , 'name' => 'utility']], |
|
196 | - ['{"Hello":"World"}', 'dependents' , ['platform' => 'npm' , 'name' => 'utility']], |
|
197 | - ['{"Hello":"World"}', 'search' , ['query' => 'grunt', 'sort' => 'rank', 'keywords' => 'wordpress']], |
|
198 | - ['{"Hello":"World"}', 'search' , ['query' => 'grunt', 'sort' => 'notvalid', 'keywords' => 'wordpress']], |
|
199 | - ['{"Hello":"World"}', 'sourcerank' , ['platform' => 'npm' , 'name' => 'utility']], |
|
200 | - ['{"Hello":"World"}', 'project' , ['platform' => 'npm' , 'name' => 'utility', 'page' => 1, 'per_page' => 30]] |
|
193 | + ['{"Hello":"World"}', 'contributors', ['platform' => 'npm', 'name' => 'utility']], |
|
194 | + ['{"Hello":"World"}', 'dependencies', ['platform' => 'npm', 'name' => 'utility', 'version' => 'latest']], |
|
195 | + ['{"Hello":"World"}', 'dependent_repositories', ['platform' => 'npm', 'name' => 'utility']], |
|
196 | + ['{"Hello":"World"}', 'dependents', ['platform' => 'npm', 'name' => 'utility']], |
|
197 | + ['{"Hello":"World"}', 'search', ['query' => 'grunt', 'sort' => 'rank', 'keywords' => 'wordpress']], |
|
198 | + ['{"Hello":"World"}', 'search', ['query' => 'grunt', 'sort' => 'notvalid', 'keywords' => 'wordpress']], |
|
199 | + ['{"Hello":"World"}', 'sourcerank', ['platform' => 'npm', 'name' => 'utility']], |
|
200 | + ['{"Hello":"World"}', 'project', ['platform' => 'npm', 'name' => 'utility', 'page' => 1, 'per_page' => 30]] |
|
201 | 201 | ]; |
202 | 202 | } |
203 | 203 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | { |
225 | 225 | $this->stub->client = $this->client; |
226 | 226 | $this->expectException(\InvalidArgumentException::class); |
227 | - $response = $this->stub->project('notvalid', ['platform' => 'npm' , 'name' => 'utility']); |
|
227 | + $response = $this->stub->project('notvalid', ['platform' => 'npm', 'name' => 'utility']); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | public static function dataRepositoryProvider(): array |
246 | 246 | { |
247 | 247 | return [ |
248 | - ['{"Hello":"World"}', 'dependencies' , ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
249 | - ['{"Hello":"World"}', 'projects' , ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
250 | - ['{"Hello":"World"}', 'repository' , ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
251 | - ['{"Hello":"World"}', 'dependencies' , ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
252 | - ['{"Hello":"World"}', 'projects' , ['owner' => 'ericsizemore', 'name' => 'utility', 'page' => 1, 'per_page' => 30]], |
|
253 | - ['{"Hello":"World"}', 'repository' , ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
248 | + ['{"Hello":"World"}', 'dependencies', ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
249 | + ['{"Hello":"World"}', 'projects', ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
250 | + ['{"Hello":"World"}', 'repository', ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
251 | + ['{"Hello":"World"}', 'dependencies', ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
252 | + ['{"Hello":"World"}', 'projects', ['owner' => 'ericsizemore', 'name' => 'utility', 'page' => 1, 'per_page' => 30]], |
|
253 | + ['{"Hello":"World"}', 'repository', ['owner' => 'ericsizemore', 'name' => 'utility']], |
|
254 | 254 | ]; |
255 | 255 | } |
256 | 256 | |
@@ -298,12 +298,12 @@ discard block |
||
298 | 298 | public static function dataUserProvider(): array |
299 | 299 | { |
300 | 300 | return [ |
301 | - ['{"Hello":"World"}', 'dependencies' , ['login' => 'ericsizemore']], |
|
302 | - ['{"Hello":"World"}', 'package_contributions' , ['login' => 'ericsizemore']], |
|
303 | - ['{"Hello":"World"}', 'packages' , ['login' => 'ericsizemore']], |
|
304 | - ['{"Hello":"World"}', 'repositories' , ['login' => 'ericsizemore']], |
|
301 | + ['{"Hello":"World"}', 'dependencies', ['login' => 'ericsizemore']], |
|
302 | + ['{"Hello":"World"}', 'package_contributions', ['login' => 'ericsizemore']], |
|
303 | + ['{"Hello":"World"}', 'packages', ['login' => 'ericsizemore']], |
|
304 | + ['{"Hello":"World"}', 'repositories', ['login' => 'ericsizemore']], |
|
305 | 305 | ['{"Hello":"World"}', 'repository_contributions', ['login' => 'ericsizemore', 'page' => 1, 'per_page' => 30]], |
306 | - ['{"Hello":"World"}', 'subscriptions' , []] |
|
306 | + ['{"Hello":"World"}', 'subscriptions', []] |
|
307 | 307 | ]; |
308 | 308 | } |
309 | 309 |