Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Interfaces

ObjectWithId::getpublic staticWC 1.0

Method of the class: ObjectWithId{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = ObjectWithId::get(): InterfaceType;

ObjectWithId::get() code WC 10.9.1

public static function get(): InterfaceType {
	if ( null === self::$instance ) {
		self::$instance = new InterfaceType(
			array(
				'name'        => 'ObjectWithId',
				'description' => __( 'An object with a numeric ID.', 'woocommerce' ),
				'fields'      => fn() => array(
					'id' => array(
						'type'        => Type::nonNull( Type::int() ),
						'description' => __( 'The unique numeric identifier.', 'woocommerce' ),
					),
				),
				'resolveType' => function ( $value ) {
					$class = get_class( $value );
					$map = array(
						'Automattic\WooCommerce\Api\Types\Coupons\Coupon' => CouponType::get(),
					);
					return $map[ $class ] ?? null;
				},
			)
		);
	}
	return self::$instance;
}