first commit

This commit is contained in:
2025-08-02 16:30:27 +02:00
commit 23646bfcee
14851 changed files with 1750626 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?php
namespace KupShop\GraphQLBundle\GraphiQL;
use Overblog\GraphiQLBundle\Config\GraphiQLControllerEndpoint;
use Overblog\GraphiQLBundle\Config\GraphQLEndpoint\GraphQLEndpointInvalidSchemaException;
use Symfony\Component\HttpFoundation\RequestStack;
use Webmozart\Assert\Assert;
final class EndpointResolver implements GraphiQLControllerEndpoint
{
/**
* @var RequestStack
*/
private $requestStack;
public function __construct(RequestStack $requestStack)
{
$this->requestStack = $requestStack;
}
public function getBySchema($name)
{
if ('default' === $name) {
$request = $this->requestStack->getCurrentRequest();
Assert::notNull($request);
return $request->getBaseUrl().'/graphql';
} elseif ($name === 'admin') {
$request = $this->requestStack->getCurrentRequest();
Assert::notNull($request);
return $request->getBaseUrl().'/admin/graphql/';
} elseif ($name === 'pos') {
$request = $this->requestStack->getCurrentRequest();
Assert::notNull($request);
return $request->getBaseUrl().'/admin/pos/graphql/';
}
throw GraphQLEndpointInvalidSchemaException::forSchemaAndResolver($name, self::class);
}
public function getDefault()
{
return $this->getBySchema('default');
}
}