PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Domain / Entity / CustomField / CustomFieldOption.php
ameliabooking / src / Domain / Entity / CustomField Last commit date
CustomField.php 6 months ago CustomFieldOption.php 6 months ago
CustomFieldOption.php
143 lines
1 <?php
2
3 /**
4 * @copyright © Melograno Ventures. All rights reserved.
5 * @licence See LICENCE.md for license details.
6 */
7
8 namespace AmeliaBooking\Domain\Entity\CustomField;
9
10 use AmeliaBooking\Domain\ValueObjects\Json;
11 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
12 use AmeliaBooking\Domain\ValueObjects\Number\Integer\IntegerValue;
13 use AmeliaBooking\Domain\ValueObjects\String\Label;
14
15 /**
16 * Class CustomFieldOption
17 *
18 * @package AmeliaBooking\Domain\Entity\CustomField
19 */
20 class CustomFieldOption
21 {
22 /** @var Id */
23 private $id;
24
25 /** @var Id */
26 private $customFieldId;
27
28 /** @var Label */
29 private $label;
30
31 /** @var IntegerValue */
32 private $position;
33
34 /** @var Json */
35 private $translations;
36
37 /**
38 * CustomFieldOption constructor.
39 *
40 * @param Label $label
41 * @param IntegerValue $position
42 */
43 public function __construct(Label $label, IntegerValue $position)
44 {
45 $this->label = $label;
46 $this->position = $position;
47 }
48
49 /**
50 * @return Id
51 */
52 public function getId()
53 {
54 return $this->id;
55 }
56
57 /**
58 * @param Id $id
59 */
60 public function setId($id)
61 {
62 $this->id = $id;
63 }
64
65 /**
66 * @return Id
67 */
68 public function getCustomFieldId()
69 {
70 return $this->customFieldId;
71 }
72
73 /**
74 * @param Id $customFieldId
75 */
76 public function setCustomFieldId($customFieldId)
77 {
78 $this->customFieldId = $customFieldId;
79 }
80
81 /**
82 * @return Label
83 */
84 public function getLabel()
85 {
86 return $this->label;
87 }
88
89 /**
90 * @param Label $label
91 */
92 public function setLabel($label)
93 {
94 $this->label = $label;
95 }
96
97 /**
98 * @return IntegerValue
99 */
100 public function getPosition()
101 {
102 return $this->position;
103 }
104
105 /**
106 * @param IntegerValue $position
107 */
108 public function setPosition($position)
109 {
110 $this->position = $position;
111 }
112
113 /**
114 * @return Json
115 */
116 public function getTranslations()
117 {
118 return $this->translations;
119 }
120
121 /**
122 * @param Json $translations
123 */
124 public function setTranslations(Json $translations)
125 {
126 $this->translations = $translations;
127 }
128
129 /**
130 * @return array
131 */
132 public function toArray()
133 {
134 return [
135 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
136 'customFieldId' => $this->getCustomFieldId() ? $this->getCustomFieldId()->getValue() : null,
137 'label' => $this->getLabel()->getValue(),
138 'position' => $this->getPosition()->getValue(),
139 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null,
140 ];
141 }
142 }
143