1 <?php
2 /* --------------------------------------------------------------
3 OrderTotal.php 2015-11-17
4 Gambio GmbH
5 http://www.gambio.de
6 Copyright (c) 2015 Gambio GmbH
7 Released under the GNU General Public License (Version 2)
8 [http://www.gnu.org/licenses/gpl-2.0.html]
9 --------------------------------------------------------------
10 */
11
12
13 /**
14 * Class OrderTotal
15 *
16 * @category System
17 * @package Order
18 * @subpackage Entities
19 */
20 class OrderTotal implements OrderTotalInterface
21 {
22 /**
23 * Title.
24 * @var string
25 */
26 protected $title = '';
27
28 /**
29 * Value.
30 * @var float
31 */
32 protected $value = 0.00;
33
34 /**
35 * Value text.
36 * @var string
37 */
38 protected $valueText = '';
39
40 /**
41 * Class name.
42 * @var string
43 */
44 protected $class = '';
45
46 /**
47 * Sort order.
48 * @var int
49 */
50 protected $sortOrder = 0;
51
52
53 /**
54 * OrderTotal constructor.
55 *
56 * @param StringType $title Order total title.
57 * @param DecimalType $value Order total value
58 * @param StringType $valueText Order total value text.
59 * @param StringType $class Class name.
60 * @param IntType $sortOrder Sort order.
61 */
62 public function __construct(StringType $title,
63 DecimalType $value,
64 StringType $valueText = null,
65 StringType $class = null,
66 IntType $sortOrder = null)
67 {
68 $this->title = $title->asString();
69 $this->value = $value->asDecimal();
70 $this->valueText = (null !== $valueText) ? $valueText->asString() : '';
71 $this->class = (null !== $class) ? $class->asString() : '';
72 $this->sortOrder = (null !== $sortOrder) ? $sortOrder->asInt() : 0;
73 }
74
75
76 /**
77 * Returns the title of the order total.
78 *
79 * @return string Title of the order total.
80 */
81 public function getTitle()
82 {
83 return $this->title;
84 }
85
86
87 /**
88 * Returns the value of the order total.
89 *
90 * @return float Value of the order total.
91 */
92 public function getValue()
93 {
94 return $this->value;
95 }
96
97
98 /**
99 * Returns the value text of the order total.
100 *
101 * @return string Value text of the order total.
102 */
103 public function getValueText()
104 {
105 return $this->valueText;
106 }
107
108
109 /**
110 * Returns the class of the order total.
111 *
112 * @return string Class of the order total.
113 */
114 public function getClass()
115 {
116 return $this->class;
117 }
118
119
120 /**
121 * Returns the sort order of the order total.
122 *
123 * @return int Sort order of the order total.
124 */
125 public function getSortOrder()
126 {
127 return $this->sortOrder;
128 }
129
130
131 /**
132 * Sets title of the order total.
133 *
134 * @param StringType $title Title of the order total.
135 *
136 * @return OrderTotal Same instance for method chaining.
137 */
138 public function setTitle(StringType $title)
139 {
140 $this->title = $title->asString();
141 }
142
143
144 /**
145 * Sets value of the order total.
146 *
147 * @param DecimalType $value Value of the order total.
148 *
149 * @return OrderTotal Same instance for method chaining.
150 */
151 public function setValue(DecimalType $value)
152 {
153 $this->value = $value->asDecimal();
154 }
155
156
157 /**
158 * Sets value text of the order total.
159 *
160 * @param StringType $valueText Value text of the order total.
161 *
162 * @return OrderTotal Same instance for method chaining.
163 */
164 public function setValueText(StringType $valueText)
165 {
166 $this->valueText = $valueText->asString();
167 }
168
169
170 /**
171 * Sets class of the order total.
172 *
173 * @param StringType $class Class of the order total.
174 *
175 * @return OrderTotal Same instance for method chaining.
176 */
177 public function setClass(StringType $class)
178 {
179 $this->class = $class->asString();
180 }
181
182
183 /**
184 * Sets sort order of the order total.
185 *
186 * @param IntType $sortOrder Sort order of the order total.
187 *
188 * @return OrderTotal Same instance for method chaining.
189 */
190 public function setSortOrder(IntType $sortOrder)
191 {
192 $this->sortOrder = $sortOrder->asInt();
193 }
194 }