Overview
  • Namespace
  • Class

Namespaces

  • WPGraphQL
    • Data
    • Type
      • Avatar
      • Comment
        • Connection
      • CommentAuthor
      • EditLock
      • Enum
      • MediaItem
        • Mutation
      • Plugin
        • Connection
      • PostObject
        • Connection
        • Mutation
      • PostType
      • Setting
      • Taxonomy
      • TermObject
        • Connection
        • Mutation
      • Theme
        • Connection
      • Union
      • User
        • Connection
        • Mutation
    • Utils

Classes

  • WPGraphQL\AppContext
  • WPGraphQL\Data\Config
  • WPGraphQL\Data\ConnectionResolver
  • WPGraphQL\Data\DataSource
  • WPGraphQL\Data\Loader
  • WPGraphQL\Router
  • WPGraphQL\Type\Avatar\AvatarType
  • WPGraphQL\Type\Comment\CommentQuery
  • WPGraphQL\Type\Comment\CommentType
  • WPGraphQL\Type\Comment\Connection\CommentConnectionArgs
  • WPGraphQL\Type\Comment\Connection\CommentConnectionDefinition
  • WPGraphQL\Type\Comment\Connection\CommentConnectionResolver
  • WPGraphQL\Type\CommentAuthor\CommentAuthorQuery
  • WPGraphQL\Type\CommentAuthor\CommentAuthorType
  • WPGraphQL\Type\EditLock\EditLockType
  • WPGraphQL\Type\Enum\MediaItemStatusEnumType
  • WPGraphQL\Type\Enum\MimeTypeEnumType
  • WPGraphQL\Type\Enum\PostObjectFieldFormatEnumType
  • WPGraphQL\Type\Enum\PostStatusEnumType
  • WPGraphQL\Type\Enum\PostTypeEnumType
  • WPGraphQL\Type\Enum\RelationEnumType
  • WPGraphQL\Type\Enum\TaxonomyEnumType
  • WPGraphQL\Type\MediaItem\MediaItemType
  • WPGraphQL\Type\MediaItem\Mutation\MediaItemCreate
  • WPGraphQL\Type\MediaItem\Mutation\MediaItemDelete
  • WPGraphQL\Type\MediaItem\Mutation\MediaItemMutation
  • WPGraphQL\Type\MediaItem\Mutation\MediaItemUpdate
  • WPGraphQL\Type\Plugin\Connection\PluginConnectionDefinition
  • WPGraphQL\Type\Plugin\Connection\PluginConnectionResolver
  • WPGraphQL\Type\Plugin\PluginQuery
  • WPGraphQL\Type\Plugin\PluginType
  • WPGraphQL\Type\PostObject\Connection\PostObjectConnectionArgs
  • WPGraphQL\Type\PostObject\Connection\PostObjectConnectionArgsDateQuery
  • WPGraphQL\Type\PostObject\Connection\PostObjectConnectionDefinition
  • WPGraphQL\Type\PostObject\Connection\PostObjectConnectionResolver
  • WPGraphQL\Type\PostObject\Mutation\PostObjectCreate
  • WPGraphQL\Type\PostObject\Mutation\PostObjectDelete
  • WPGraphQL\Type\PostObject\Mutation\PostObjectMutation
  • WPGraphQL\Type\PostObject\Mutation\PostObjectUpdate
  • WPGraphQL\Type\PostObject\Mutation\TermObjectDelete
  • WPGraphQL\Type\PostObject\PostObjectQuery
  • WPGraphQL\Type\PostObject\PostObjectType
  • WPGraphQL\Type\PostType\PostTypeType
  • WPGraphQL\Type\RootMutationType
  • WPGraphQL\Type\RootQueryType
  • WPGraphQL\Type\Setting\SettingQuery
  • WPGraphQL\Type\Setting\SettingType
  • WPGraphQL\Type\Taxonomy\TaxonomyType
  • WPGraphQL\Type\TermObject\Connection\TermObjectConnectionArgs
  • WPGraphQL\Type\TermObject\Connection\TermObjectConnectionDefinition
  • WPGraphQL\Type\TermObject\Connection\TermObjectConnectionResolver
  • WPGraphQL\Type\TermObject\Mutation\TermObjectCreate
  • WPGraphQL\Type\TermObject\Mutation\TermObjectMutation
  • WPGraphQL\Type\TermObject\Mutation\TermObjectUpdate
  • WPGraphQL\Type\TermObject\TermObjectQuery
  • WPGraphQL\Type\TermObject\TermObjectType
  • WPGraphQL\Type\Theme\Connection\ThemeConnectionDefinition
  • WPGraphQL\Type\Theme\Connection\ThemeConnectionResolver
  • WPGraphQL\Type\Theme\ThemeType
  • WPGraphQL\Type\Union\CommentAuthorUnionType
  • WPGraphQL\Type\Union\PostObjectUnionType
  • WPGraphQL\Type\Union\TermObjectUnionType
  • WPGraphQL\Type\User\Connection\UserConnectionArgs
  • WPGraphQL\Type\User\Connection\UserConnectionDefinition
  • WPGraphQL\Type\User\Connection\UserConnectionResolver
  • WPGraphQL\Type\User\Mutation\UserCreate
  • WPGraphQL\Type\User\Mutation\UserDelete
  • WPGraphQL\Type\User\Mutation\UserMutation
  • WPGraphQL\Type\User\Mutation\UserUpdate
  • WPGraphQL\Type\User\UserQuery
  • WPGraphQL\Type\User\UserType
  • WPGraphQL\Type\WPEnumType
  • WPGraphQL\Type\WPInputObjectType
  • WPGraphQL\Type\WPObjectType
  • WPGraphQL\Types
  • WPGraphQL\Utils\InstrumentSchema
  • WPGraphQL\WPSchema

Interfaces

  • WPGraphQL\Data\ConnectionResolverInterface
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 
<?php

namespace WPGraphQL;

use GraphQL\Type\Definition\ListOfType;
use GraphQL\Type\Definition\NonNull;
use GraphQL\Type\Definition\Type;
use WPGraphQL\Type\Avatar\AvatarType;
use WPGraphQL\Type\Comment\CommentType;
use WPGraphQL\Type\CommentAuthor\CommentAuthorType;
use WPGraphQL\Type\EditLock\EditLockType;
use WPGraphQL\Type\Enum\MimeTypeEnumType;
use WPGraphQL\Type\Enum\PostObjectFieldFormatEnumType;
use WPGraphQL\Type\Enum\PostStatusEnumType;
use WPGraphQL\Type\Enum\MediaItemStatusEnumType;
use WPGraphQL\Type\Enum\PostTypeEnumType;
use WPGraphQL\Type\Enum\RelationEnumType;
use WPGraphQL\Type\Enum\TaxonomyEnumType;
use WPGraphQL\Type\Setting\SettingType;
use WPGraphQL\Type\PostObject\Connection\PostObjectConnectionArgs;
use WPGraphQL\Type\RootMutationType;
use WPGraphQL\Type\RootQueryType;
use WPGraphQL\Type\Plugin\PluginType;
use WPGraphQL\Type\PostObject\PostObjectType;
use WPGraphQL\Type\PostType\PostTypeType;
use WPGraphQL\Type\Taxonomy\TaxonomyType;
use WPGraphQL\Type\TermObject\Connection\TermObjectConnectionArgs;
use WPGraphQL\Type\TermObject\TermObjectType;
use WPGraphQL\Type\Theme\ThemeType;
use WPGraphQL\Type\Union\CommentAuthorUnionType;
use WPGraphQL\Type\Union\PostObjectUnionType;
use WPGraphQL\Type\Union\TermObjectUnionType;
use WPGraphQL\Type\User\Connection\UserConnectionArgs;
use WPGraphQL\Type\User\UserType;

/**
 * Class Types - Acts as a registry and factory for Types.
 *
 * Each "type" is static ensuring that it will only be instantiated once and can be re-used
 * throughout the system. The types that are "dynamic" (such as post_types, taxonomies, etc)
 * are added as a sub-property to the Types class based on their unique identifier, and are
 * therefore only instantiated once as well.
 *
 * @since   0.0.5
 * @package WPGraphQL
 */
class Types {

    /**
     * Stores the avatar type object
     *
     * @var AvatarType object $avatar
     * @since  0.5.0
     * @access private
     */
    private static $avatar;

    /**
     * Stores the comment type object
     *
     * @var CommentType object $comment
     * @since  0.5.0
     * @access private
     */
    private static $comment;

    /**
     * Stores the comment author type object
     *
     * @var CommentAuthorType object $comment_author
     * @since  0.0.21
     * @access private
     */
    private static $comment_author;

    /**
     * Stores the comment author union type config
     *
     * @var CommentAuthorUnionType object $comment_author_union
     * @since  0.0.21
     * @access private
     */
    private static $comment_author_union;

    /**
     * Stores the EditLock definition
     *
     * @var EditLockType object $edit_lock
     * @access private
     */
    private static $edit_lock;

    /**
     * Stores the mime type enum object
     *
     * @var MimeTypeEnumType object $mime_type_enum
     * @since  0.5.0
     * @access private
     */
    private static $mime_type_enum;

    /**
     * Stores the plugin type object
     *
     * @var PluginType $plugin
     * @since  0.5.0
     * @access private
     */
    private static $plugin;

    /**
     * Stores the post object type
     *
     * @var PostObjectType $post_object
     * @since  0.5.0
     * @access private
     */
    private static $post_object;

    /**
     * Stores the post object type query args
     *
     * @var PostObjectConnectionArgs object $post_object_query_args
     * @since  0.5.0
     * @access private
     */
    private static $post_object_query_args;

    /**
     * Stores the post object union type config
     *
     * @var PostObjectUnionType object $post_object_union
     * @since  0.0.6
     * @access private
     */
    private static $post_object_union;

    /**
     * Stores the post object field format enum type object
     *
     * @var PostObjectFieldFormatEnumType object $post_object_field_format_enum
     * @since  0.0.18
     * @access private
     */
    private static $post_object_field_format_enum;

    /**
     * Stores the post status enum type object
     *
     * @var PostStatusEnumType object $post_status_enum
     * @since  0.0.5
     * @access private
     */
    private static $post_status_enum;

    /**
     * Stores the media item (attachment) status enum type object
     *
     * @var MediaItemStatusEnumType object $media_item_status_enum
     * @access private
     */
    private static $media_item_status_enum;

    /**
     * Stores the post type enum type object
     *
     * @var PostTypeEnumType object $post_type_enum
     * @since  0.5.0
     * @access private
     */
    private static $post_type_enum;

    /**
     * Stores the post type type object
     *
     * @var PostTypeType object $post_type
     * @since  0.5.0
     * @access private
     */
    private static $post_type;

    /**
     * Stores the relation enum type object
     *
     * @var RelationEnumType object $relation_enum
     * @since  0.5.0
     * @access private
     */
    private static $relation_enum;

    /**
     * Stores the root mutation type object
     *
     * @var RootMutationType object $root_mutation
     * @since  0.0.6
     * @access private
     */
    private static $root_mutation;

    /**
     * Stores the root query type object
     *
     * @var RootQueryType object $root_query
     * @since  0.5.0
     * @access private
     */
    private static $root_query;

    /**
     * Stores the setting object type
     *
     * @var SettingType object $setting
     * @access private
     */
    private static $setting;
    
    /**
     * Stores the taxonomy type object
     *
     * @var TaxonomyType object $taxonomy
     * @since  0.5.0
     * @access private
     */
    private static $taxonomy;

    /**
     * Stores the taxonomy enum type object
     *
     * @var TaxonomyEnumType object $taxonomy_enum
     * @since  0.5.0
     * @access private
     */
    private static $taxonomy_enum;

    /**
     * Stores the term type object
     *
     * @var TermObjectType object $term_object
     * @since  0.5.0
     * @access private
     */
    private static $term_object;

    /**
     * Stores the term object union definition
     *
     * @var TermObjectUnionType object $term_object_union
     * @access private
     */
    private static $term_object_union;

    /**
     * Stores the term object query args type
     *
     * @var TermObjectConnectionArgs object $term_object_query_args
     * @since  0.5.0
     * @access private
     */
    private static $term_object_query_args;

    /**
     * Stores the theme type object
     *
     * @var ThemeType object $theme
     * @since  0.5.0
     * @access private
     */
    private static $theme;

    /**
     * Stores the user type object
     *
     * @var UserType object $user
     * @since  0.5.0
     * @access private
     */
    private static $user;

    /**
     * Stores the user connection query args type object
     *
     * @var UserConnectionArgs object $user_connection_query_args
     * @since  0.5.0
     * @access private
     */
    private static $user_connection_query_args;

    /**
     * This returns the definition for the AvatarType
     *
     * @return AvatarType object
     * @since  0.0.5
     * @access public
     */
    public static function avatar() {
        return self::$avatar ? : ( self::$avatar = new AvatarType() );
    }

    /**
     * This returns the definition for the CommentType
     *
     * @return CommentType object
     * @since  0.0.5
     * @access public
     */
    public static function comment() {
        return self::$comment ? : ( self::$comment = new CommentType() );
    }

    /**
     * This returns the definition for the CommentAuthorType
     *
     * @return CommentAuthorType object
     * @since  0.0.21
     * @access public
     */
    public static function comment_author() {
        return self::$comment_author ? : ( self::$comment_author = new CommentAuthorType() );
    }

    /**
     * This returns the definition for the PostObjectUnionType
     *
     * @return CommentAuthorUnionType object
     * @since  0.0.21
     * @access public
     */
    public static function comment_author_union() {
        return self::$comment_author_union ? : ( self::$comment_author_union = new CommentAuthorUnionType() );
    }

    /**
     * This returns the definition for the EditLock type
     *
     * @return EditLockType object
     * @access public
     */
    public static function edit_lock() {
        return self::$edit_lock ? : ( self::$edit_lock = new EditLockType() );
    }

    /**
     * This returns the definition for the MimeTypeEnumType
     *
     * @return MimeTypeEnumType object
     * @since  0.0.5
     * @access public
     */
    public static function mime_type_enum() {
        return self::$mime_type_enum ? : ( self::$mime_type_enum = new MimeTypeEnumType() );
    }

    /**
     * This returns the definition for the SettingType
     *
     * @return SettingType object
     * @access public
     */
    public static function setting( $setting_type ) {

        if ( null === self::$setting ) {
            self::$setting = [];
        }

        if ( empty( self::$setting[ $setting_type ] ) ) {
            self::$setting[ $setting_type ] = new SettingType( $setting_type );
        }

        return ! empty( self::$setting[ $setting_type ] ) ? self::$setting[ $setting_type ] : null;

    }

    /**
     * This returns the definition for the PluginType
     *
     * @return PluginType object
     * @since  0.0.5
     * @access public
     */
    public static function plugin() {
        return self::$plugin ? : ( self::$plugin = new PluginType() );
    }

    /**
     * This returns the definition for the PostObjectType
     *
     * @param string $post_type Name of the post type you want to retrieve the PostObjectType for
     *
     * @return PostObjectType object
     * @since  0.0.5
     * @access public
     */
    public static function post_object( $post_type ) {

        if ( null === self::$post_object ) {
            self::$post_object = [];
        }

        if ( empty( self::$post_object[ $post_type ] ) ) {
            self::$post_object[ $post_type ] = new PostObjectType( $post_type );
        }

        return ! empty( self::$post_object[ $post_type ] ) ? self::$post_object[ $post_type ] : null;

    }

    /**
     * This returns the definition for the PostObjectUnionType
     *
     * @return PostObjectUnionType object
     * @since  0.0.5
     * @access public
     */
    public static function post_object_union() {
        return self::$post_object_union ? : ( self::$post_object_union = new PostObjectUnionType() );
    }

    /**
     * This returns the definition for the PostObjectFieldFormatEnumType
     *
     * @return PostObjectFieldFormatEnumType object
     * @since  0.1.18
     * @access public
     */
    public static function post_object_field_format_enum() {
        return self::$post_object_field_format_enum ? : ( self::$post_object_field_format_enum = new PostObjectFieldFormatEnumType() );
    }

    /**
     * This returns the definition for the PostStatusEnumType
     *
     * @return PostStatusEnumType object
     * @since  0.0.5
     * @access public
     */
    public static function post_status_enum() {
        return self::$post_status_enum ? : ( self::$post_status_enum = new PostStatusEnumType() );
    }

    /**
     * This returns the definition for the MediaItemStatusEnumType
     *
     * @return MediaItemStatusEnumType object
     * @access public
     */
    public static function media_item_status_enum() {
        return self::$media_item_status_enum ? : ( self::$media_item_status_enum = new MediaItemStatusEnumType() );
    }

    /**
     * This returns the definition for the PostStatusEnumType
     *
     * @return PostTypeEnumType object
     * @since  0.0.5
     * @access public
     */
    public static function post_type_enum() {
        return self::$post_type_enum ? : ( self::$post_type_enum = new PostTypeEnumType() );
    }

    /**
     * This returns the definition for the PostObjectConnectionArgs
     *
     * @return PostObjectConnectionArgs object
     * @since  0.0.5
     * @access public
     */
    public static function post_object_query_args() {
        return self::$post_object_query_args ? : ( self::$post_object_query_args = new PostObjectConnectionArgs() );
    }

    /**
     * This returns the definition for the PostTypeType
     *
     * @return PostTypeType object
     * @since  0.0.5
     * @access public
     */
    public static function post_type() {
        return self::$post_type ? : ( self::$post_type = new PostTypeType() );
    }

    /**
     * This returns the definition for the RelationEnum
     *
     * @return RelationEnumType object
     * @since  0.0.5
     * @access public
     */
    public static function relation_enum() {
        return self::$relation_enum ? : ( self::$relation_enum = new RelationEnumType() );
    }

    /**
     * This returns the definition for the RootMutationType
     *
     * @return RootMutationType object
     * @since  0.0.8
     * @access public
     */
    public static function root_mutation() {
        return self::$root_mutation ? : ( self::$root_mutation = new RootMutationType() );
    }


    /**
     * This returns the definition for the RootQueryType
     *
     * @return RootQueryType object
     * @since  0.0.5
     * @access public
     */
    public static function root_query() {
        return self::$root_query ? : ( self::$root_query = new RootQueryType() );
    }

    /**
     * This returns the definition for the TaxonomyType
     *
     * @return TaxonomyType object
     * @since  0.0.5
     * @access public
     */
    public static function taxonomy() {
        return self::$taxonomy ? : ( self::$taxonomy = new TaxonomyType() );
    }

    /**
     * This returns the definition for the TaxonomyEnumType
     *
     * @return TaxonomyEnumType object
     * @since  0.0.5
     * @access public
     */
    public static function taxonomy_enum() {
        return self::$taxonomy_enum ? : ( self::$taxonomy_enum = new TaxonomyEnumType() );
    }

    /**
     * This returns the definition for the TermObjectType
     *
     * @param string $taxonomy Name of the taxonomy you want to get the TermObjectType for
     *
     * @return TermObjectType object
     * @since  0.0.5
     * @access public
     */
    public static function term_object( $taxonomy ) {

        if ( null === self::$term_object ) {
            self::$term_object = [];
        }

        if ( empty( self::$term_object[ $taxonomy ] ) ) {
            self::$term_object[ $taxonomy ] = new TermObjectType( $taxonomy );
        }

        return ! empty( self::$term_object[ $taxonomy ] ) ? self::$term_object[ $taxonomy ] : null;

    }

    /**
     * This returns the definition for the TermObjectConnectionArgs
     *
     * @return TermObjectConnectionArgs object
     * @since  0.0.5
     * @access public
     */
    public static function term_object_query_args() {
        return self::$term_object_query_args ? : ( self::$term_object_query_args = new TermObjectConnectionArgs() );
    }

    /**
     * This returns the definition for the termObjectUnionType
     *
     * @return TermObjectUnionType object
     * @access public
     */
    public static function term_object_union() {
        return self::$term_object_union ? : ( self::$term_object_union = new TermObjectUnionType() );
    }

    /**
     * This returns the definition for the ThemeType
     *
     * @return ThemeType object
     * @since  0.0.5
     * @access public
     */
    public static function theme() {
        return self::$theme ? : ( self::$theme = new ThemeType() );
    }

    /**
     * This returns the definition for the UserType
     *
     * @return UserType object
     * @since  0.0.5
     * @access public
     */
    public static function user() {
        return self::$user ? : ( self::$user = new UserType() );
    }

    /**
     * This returns the definition for the UserConnectionArgs
     *
     * @return UserConnectionArgs object
     * @since  0.0.5
     * @access public
     */
    public static function user_connection_query_args() {
        return self::$user_connection_query_args ? : ( self::$user_connection_query_args = new UserConnectionArgs() );
    }

    /**
     * This is a wrapper for the GraphQL type to give a consistent experience
     *
     * @return \GraphQL\Type\Definition\BooleanType
     * @since  0.0.5
     * @access public
     */
    public static function boolean() {
        return Type::boolean();
    }

    /**
     * This is a wrapper for the GraphQL type to give a consistent experience
     *
     * @return \GraphQL\Type\Definition\FloatType
     * @since  0.0.5
     * @access public
     */
    public static function float() {
        return Type::float();
    }

    /**
     * This is a wrapper for the GraphQL type to give a consistent experience
     *
     * @return \GraphQL\Type\Definition\idType
     * @since  0.0.5
     * @access public
     */
    public static function id() {
        return Type::id();
    }

    /**
     * This is a wrapper for the GraphQL type to give a consistent experience
     *
     * @return \GraphQL\Type\Definition\IntType
     * @since  0.0.5
     * @access public
     */
    public static function int() {
        return Type::int();
    }

    /**
     * This is a wrapper for the GraphQL type to give a consistent experience
     *
     * @return \GraphQL\Type\Definition\StringType
     * @since  0.0.5
     * @access public
     */
    public static function string() {
        return Type::string();
    }

    /**
     * This is a wrapper for the GraphQL type to give a consistent experience
     *
     * @param callable $type instance of GraphQL\Type\Definition\Type or callable returning instance
     *                       of that class
     *
     * @return \GraphQL\Type\Definition\ListOfType
     * @since  0.0.5
     * @access public
     */
    public static function list_of( $type ) {
        return new ListOfType( $type );
    }

    /**
     * This is a wrapper for the GraphQL type to give a consistent experience
     *
     * @param callable $type instance of GraphQL\Type\Definition\Type or callable returning instance
     *                       of that class
     *
     * @return \GraphQL\Type\Definition\NonNull
     * @since  0.0.5
     * @access public
     */
    public static function non_null( $type ) {
        return new NonNull( $type );
    }

    /**
     * Resolve the type on the individual setting field
     * for the settingsType
     *
     * @param $type
     * @access public
     *
     * @return \GraphQL\Type\Definition\BooleanType|\GraphQL\Type\Definition\FloatType|\GraphQL\Type\Definition\IntType|\GraphQL\Type\Definition\StringType
     */
    public static function get_type( $type ) {

        switch ( $type ) {
            case 'integer':
                $type = self::int();
                break;
            case 'float':
            case 'number':
                $type = self::float();
                break;
            case 'boolean':
                $type = self::boolean();
                break;
            case 'string':
            default:
                $type = self::string();
        }

        return $type;
    }

    /**
     * Maps new input query args and sanitizes the input
     *
     * @param array $args The raw query args from the GraphQL query
     * @param array $map  The mapping of where each of the args should go
     *
     * @since  0.5.0
     * @return array
     * @access public
     */
    public static function map_input( $args, $map ) {

        if ( ! is_array( $args ) || ! is_array( $map ) ) {
            return array();
        }

        $query_args = [];

        foreach ( $args as $arg => $value ) {

            if ( is_array( $value ) && ! empty( $value ) ) {
                $value = array_map( function( $value ) {
                    if ( is_string( $value ) ) {
                        $value = sanitize_text_field( $value );
                    }

                    return $value;
                }, $value );
            } elseif ( is_string( $value ) ) {
                $value = sanitize_text_field( $value );
            }

            if ( array_key_exists( $arg, $map ) ) {
                $query_args[ $map[ $arg ] ] = $value;
            } else {
                $query_args[ $arg ] = $value;
            }
        }

        return $query_args;

    }

}
API documentation generated by ApiGen