Input.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /**
  9. * Class representing 'input' GraphQL config element.
  10. */
  11. class Input implements TypeInterface
  12. {
  13. /**
  14. * @var string
  15. */
  16. private $name;
  17. /**
  18. * @var Field[]
  19. */
  20. private $fields;
  21. /**
  22. * @var string
  23. */
  24. private $description;
  25. /**
  26. * @param string $name
  27. * @param Field[] $fields
  28. * @param string $description
  29. */
  30. public function __construct(
  31. string $name,
  32. array $fields,
  33. string $description
  34. ) {
  35. $this->name = $name;
  36. $this->fields = $fields;
  37. $this->description = $description;
  38. }
  39. /**
  40. * Get the type name.
  41. *
  42. * @return string
  43. */
  44. public function getName(): string
  45. {
  46. return $this->name;
  47. }
  48. /**
  49. * Get a list of fields that make up the possible return or input values of a type.
  50. *
  51. * @return Field[]
  52. */
  53. public function getFields(): array
  54. {
  55. return $this->fields;
  56. }
  57. /**
  58. * Get a human-readable description of the type.
  59. *
  60. * @return string
  61. */
  62. public function getDescription(): string
  63. {
  64. return $this->description;
  65. }
  66. }