|
10 | 10 | /**
|
11 | 11 | * Simple yet very cool PHP GitHub client
|
12 | 12 | *
|
| 13 | + * @method Api\CurrentUser currentUser() |
| 14 | + * @method Api\CurrentUser me() |
| 15 | + * @method Api\Enterprise ent() |
| 16 | + * @method Api\Enterprise enterprise() |
| 17 | + * @method Api\GitData git() |
| 18 | + * @method Api\GitData gitData() |
| 19 | + * @method Api\Gists gist() |
| 20 | + * @method Api\Gists gists() |
| 21 | + * @method Api\Issue issue() |
| 22 | + * @method Api\Issue issues() |
| 23 | + * @method Api\Markdown markdown() |
| 24 | + * @method Api\Organization organization() |
| 25 | + * @method Api\Organization organizations() |
| 26 | + * @method Api\PullRequest pr() |
| 27 | + * @method Api\PullRequest pullRequest() |
| 28 | + * @method Api\PullRequest pullRequests() |
| 29 | + * @method Api\Repo repo() |
| 30 | + * @method Api\Repo repos() |
| 31 | + * @method Api\Repo repository() |
| 32 | + * @method Api\Repo repositories() |
| 33 | + * @method Api\Organization team() |
| 34 | + * @method Api\Organization teams() |
| 35 | + * @method Api\User user() |
| 36 | + * @method Api\User users() |
| 37 | + * @method Api\Authorizations authorization() |
| 38 | + * @method Api\Authorizations authorizations() |
| 39 | + * @method Api\Meta meta() |
| 40 | + * |
13 | 41 | * @author Joseph Bielawski <stloyd@gmail.com>
|
14 | 42 | *
|
15 | 43 | * Website: http://github.com/KnpLabs/php-github-api
|
@@ -274,4 +302,86 @@ public function getSupportedApiVersions()
|
274 | 302 | {
|
275 | 303 | return array('v3', 'beta');
|
276 | 304 | }
|
| 305 | + |
| 306 | + /** |
| 307 | + * @param string $name |
| 308 | + * |
| 309 | + * @return ApiInterface |
| 310 | + * |
| 311 | + * @throws InvalidArgumentException |
| 312 | + */ |
| 313 | + public function __call($name) { |
| 314 | + switch ($name) { |
| 315 | + case 'me': |
| 316 | + case 'currentUser': |
| 317 | + $api = new Api\CurrentUser($this); |
| 318 | + break; |
| 319 | + |
| 320 | + case 'ent': |
| 321 | + case 'enterprise': |
| 322 | + $api = new Api\Enterprise($this); |
| 323 | + break; |
| 324 | + |
| 325 | + case 'git': |
| 326 | + case 'gitData': |
| 327 | + $api = new Api\GitData($this); |
| 328 | + break; |
| 329 | + |
| 330 | + case 'gist': |
| 331 | + case 'gists': |
| 332 | + $api = new Api\Gists($this); |
| 333 | + break; |
| 334 | + |
| 335 | + case 'issue': |
| 336 | + case 'issues': |
| 337 | + $api = new Api\Issue($this); |
| 338 | + break; |
| 339 | + |
| 340 | + case 'markdown': |
| 341 | + $api = new Api\Markdown($this); |
| 342 | + break; |
| 343 | + |
| 344 | + case 'organization': |
| 345 | + case 'organizations': |
| 346 | + $api = new Api\Organization($this); |
| 347 | + break; |
| 348 | + |
| 349 | + case 'pr': |
| 350 | + case 'pullRequest': |
| 351 | + case 'pullRequests': |
| 352 | + $api = new Api\PullRequest($this); |
| 353 | + break; |
| 354 | + |
| 355 | + case 'repo': |
| 356 | + case 'repos': |
| 357 | + case 'repository': |
| 358 | + case 'repositories': |
| 359 | + $api = new Api\Repo($this); |
| 360 | + break; |
| 361 | + |
| 362 | + case 'team': |
| 363 | + case 'teams': |
| 364 | + $api = new Api\Organization\Teams($this); |
| 365 | + break; |
| 366 | + |
| 367 | + case 'user': |
| 368 | + case 'users': |
| 369 | + $api = new Api\User($this); |
| 370 | + break; |
| 371 | + |
| 372 | + case 'authorization': |
| 373 | + case 'authorizations': |
| 374 | + $api = new Api\Authorizations($this); |
| 375 | + break; |
| 376 | + |
| 377 | + case 'meta': |
| 378 | + $api = new Api\Meta($this); |
| 379 | + break; |
| 380 | + |
| 381 | + default: |
| 382 | + throw new InvalidArgumentException(sprintf('Undefined api instance called: "%s"', $name)); |
| 383 | + } |
| 384 | + |
| 385 | + return $api; |
| 386 | + } |
277 | 387 | }
|
0 commit comments