| @@ 344-358 (lines=15) @@ | ||
| 341 | * @param array $args |
|
| 342 | * @return null|string |
|
| 343 | */ |
|
| 344 | public static function resolveTypeFields($source, array $args) { |
|
| 345 | if ($source instanceof ObjectType || $source instanceof InterfaceType) { |
|
| 346 | $fields = $source->getFields(); |
|
| 347 | ||
| 348 | if (empty($args['includeDeprecated'])) { |
|
| 349 | $fields = array_filter($fields, function (FieldDefinition $field) { |
|
| 350 | return !$field->getDeprecationReason(); |
|
| 351 | }); |
|
| 352 | } |
|
| 353 | ||
| 354 | return array_values($fields); |
|
| 355 | } |
|
| 356 | ||
| 357 | return NULL; |
|
| 358 | } |
|
| 359 | ||
| 360 | /** |
|
| 361 | * @param $source |
|
| @@ 389-403 (lines=15) @@ | ||
| 386 | * @param array $args |
|
| 387 | * @return array |
|
| 388 | */ |
|
| 389 | public static function resolveTypeEnumValues($source, array $args) { |
|
| 390 | if ($source instanceof EnumType) { |
|
| 391 | $values = $source->getValues(); |
|
| 392 | ||
| 393 | if (empty($args['includeDeprecated'])) { |
|
| 394 | $values = array_filter($values, function (EnumValueDefinition $value) { |
|
| 395 | return !$value->getDeprecationReason(); |
|
| 396 | }); |
|
| 397 | } |
|
| 398 | ||
| 399 | return array_values($values); |
|
| 400 | } |
|
| 401 | ||
| 402 | return NULL; |
|
| 403 | } |
|
| 404 | ||
| 405 | /** |
|
| 406 | * @param $source |
|