EnumValue.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. * Describes a value for an enum type.
  11. */
  12. class EnumValue implements ConfigElementInterface
  13. {
  14. /**
  15. * @var string
  16. */
  17. private $name;
  18. /**
  19. * @var string
  20. */
  21. private $value;
  22. /**
  23. * @var string
  24. */
  25. private $description;
  26. /**
  27. * @param string $name
  28. * @param string $value
  29. * @param string $description
  30. */
  31. public function __construct(string $name, string $value, string $description = '')
  32. {
  33. $this->name = $name;
  34. $this->value = $value;
  35. $this->description = $description;
  36. }
  37. /**
  38. * Get the enum value's name/key.
  39. *
  40. * @return string
  41. */
  42. public function getName(): string
  43. {
  44. return $this->name;
  45. }
  46. /**
  47. * Get the enum value's value.
  48. *
  49. * @return string
  50. */
  51. public function getValue() : string
  52. {
  53. return $this->value;
  54. }
  55. /**
  56. * Get the enum value's description.
  57. *
  58. * @return string
  59. */
  60. public function getDescription() : string
  61. {
  62. return $this->description;
  63. }
  64. }