Enum.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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\Config\Element;
  8. use Magento\Framework\GraphQl\Config\ConfigElementInterface;
  9. /**
  10. * Class representing 'enum' GraphQL config element.
  11. */
  12. class Enum implements ConfigElementInterface
  13. {
  14. /**
  15. * @var string
  16. */
  17. private $name;
  18. /**
  19. * @var array
  20. */
  21. private $values;
  22. /**
  23. * @var string
  24. */
  25. private $description;
  26. /**
  27. * @param string $name
  28. * @param EnumValue[] $values
  29. * @param string $description
  30. */
  31. public function __construct(
  32. string $name,
  33. array $values,
  34. string $description
  35. ) {
  36. $this->name = $name;
  37. $this->values = $values;
  38. $this->description = $description;
  39. }
  40. /**
  41. * Get name.
  42. *
  43. * @return string
  44. */
  45. public function getName() : string
  46. {
  47. return $this->name;
  48. }
  49. /**
  50. * Get an array of all possible values for the Enum.
  51. *
  52. * @return EnumValue[]
  53. */
  54. public function getValues() : array
  55. {
  56. return $this->values;
  57. }
  58. /**
  59. * Return human-readable description of Enum.
  60. *
  61. * @return string
  62. */
  63. public function getDescription() : string
  64. {
  65. return $this->description;
  66. }
  67. }