IntrospectionConfiguration.php 992 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Framework\GraphQl\Query;
  8. use Magento\Framework\App\DeploymentConfig;
  9. /**
  10. * Class for fetching the availability of introspection queries
  11. */
  12. class IntrospectionConfiguration
  13. {
  14. private const CONFIG_PATH_DISABLE_INTROSPECTION = 'graphql/disable_introspection';
  15. /**
  16. * @var DeploymentConfig
  17. */
  18. private $deploymentConfig;
  19. /**
  20. * @param DeploymentConfig $deploymentConfig
  21. */
  22. public function __construct(
  23. DeploymentConfig $deploymentConfig
  24. ) {
  25. $this->deploymentConfig = $deploymentConfig;
  26. }
  27. /**
  28. * Check the the environment config to determine if introspection should be disabled.
  29. *
  30. * @return bool
  31. */
  32. public function isIntrospectionDisabled(): bool
  33. {
  34. return (bool)$this->deploymentConfig->get(self::CONFIG_PATH_DISABLE_INTROSPECTION);
  35. }
  36. }