CheckoutField.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Model\Checkout\Schema;
  6. /**
  7. * CheckoutField
  8. *
  9. * Typed representation of the original json field definition.
  10. *
  11. * @package Temando\Shipping\Model
  12. * @author Sebastian Ertner <sebastian.ertner@netresearch.de>
  13. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  14. * @link http://www.temando.com/
  15. */
  16. class CheckoutField
  17. {
  18. /**
  19. * @var string
  20. */
  21. private $id;
  22. /**
  23. * @var string
  24. */
  25. private $label;
  26. /**
  27. * @var string
  28. */
  29. private $type;
  30. /**
  31. * @var string
  32. */
  33. private $orderPath;
  34. /**
  35. * @var string
  36. */
  37. private $defaultValue;
  38. /**
  39. * @var string[]
  40. */
  41. private $options = [];
  42. /**
  43. * CheckoutField constructor.
  44. * @param string $id
  45. * @param string $label
  46. * @param string $type
  47. * @param string $orderPath
  48. * @param string $defaultValue
  49. * @param mixed[] $options
  50. */
  51. public function __construct(
  52. $id,
  53. $label,
  54. $type,
  55. $orderPath,
  56. $defaultValue = '',
  57. array $options = []
  58. ) {
  59. $this->id = $id;
  60. $this->label = $label;
  61. $this->type = $type;
  62. $this->orderPath = $orderPath;
  63. $this->defaultValue = $defaultValue;
  64. $this->options = $options;
  65. }
  66. /**
  67. * @return string
  68. */
  69. public function getId()
  70. {
  71. return $this->id;
  72. }
  73. /**
  74. * @return string
  75. */
  76. public function getLabel()
  77. {
  78. return $this->label;
  79. }
  80. /**
  81. * @return string
  82. */
  83. public function getType()
  84. {
  85. return $this->type;
  86. }
  87. /**
  88. * @return string
  89. */
  90. public function getOrderPath()
  91. {
  92. return $this->orderPath;
  93. }
  94. /**
  95. * @return string
  96. */
  97. public function getDefaultValue()
  98. {
  99. return $this->defaultValue;
  100. }
  101. /**
  102. * @return string[]
  103. */
  104. public function getOptions()
  105. {
  106. return $this->options;
  107. }
  108. /**
  109. * @return string[]
  110. */
  111. public function toArray()
  112. {
  113. return get_object_vars($this);
  114. }
  115. }