1 | <?php |
||
27 | class Charge implements ICharge |
||
28 | { |
||
29 | use TPayload; |
||
30 | |||
31 | /** @var string */ |
||
32 | protected $name; |
||
33 | /** @var string */ |
||
34 | protected $category; |
||
35 | /** @var bool */ |
||
36 | protected $isDiscount; |
||
37 | /** @var bool */ |
||
38 | protected $isPromotion; |
||
39 | /** @var string */ |
||
40 | protected $informational; |
||
41 | /** @var float */ |
||
42 | protected $unitPrice; |
||
43 | /** @var float */ |
||
44 | protected $linePrice; |
||
45 | /** @var float */ |
||
46 | protected $amount; |
||
47 | |||
48 | /** |
||
49 | * @param IValidatorIterator |
||
50 | * @param ISchemaValidator |
||
51 | * @param IPayloadMap |
||
52 | * @param LoggerInterface |
||
53 | * @param IPayload |
||
54 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
55 | */ |
||
56 | public function __construct( |
||
57 | IValidatorIterator $validators, |
||
58 | ISchemaValidator $schemaValidator, |
||
59 | IPayloadMap $payloadMap, |
||
60 | LoggerInterface $logger, |
||
61 | IPayload $parentPayload = null |
||
62 | ) { |
||
63 | $this->logger = $logger; |
||
|
|||
64 | $this->validators = $validators; |
||
65 | $this->schemaValidator = $schemaValidator; |
||
66 | $this->parentPayload = $parentPayload; |
||
67 | $this->payloadMap = $payloadMap; |
||
68 | $this->payloadFactory = $this->getNewPayloadFactory(); |
||
69 | $this->initOptionalExtractPaths(); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * Initialize the protected class property array self::optionalExtractionPaths with xpath |
||
74 | * key/value pairs. |
||
75 | * |
||
76 | * @return self |
||
77 | */ |
||
78 | protected function initOptionalExtractPaths() |
||
79 | { |
||
80 | $this->optionalExtractionPaths = [ |
||
81 | 'name' => '@name', |
||
82 | 'category' => '@category', |
||
83 | 'isDiscount' => '@isDiscount', |
||
84 | 'isPromotion' => '@isPromotion', |
||
85 | 'informational' => '@informational', |
||
86 | 'unitPrice' => '@unitPrice', |
||
87 | 'linePrice' => '@linePrice', |
||
88 | 'amount' => '@amount', |
||
89 | ]; |
||
90 | return $this; |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @see ICharge::getName() |
||
95 | */ |
||
96 | public function getName() |
||
100 | |||
101 | /** |
||
102 | * @see ICharge::setName() |
||
103 | * @codeCoverageIgnore |
||
104 | */ |
||
105 | public function setName($name) |
||
106 | { |
||
107 | $this->name = $name; |
||
108 | return $this; |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * @see ICharge::getCategory() |
||
113 | */ |
||
114 | public function getCategory() |
||
118 | |||
119 | /** |
||
120 | * @see ICharge::setCategory() |
||
121 | * @codeCoverageIgnore |
||
122 | */ |
||
123 | public function setCategory($category) |
||
124 | { |
||
125 | $this->category = $category; |
||
126 | return $this; |
||
127 | } |
||
128 | |||
129 | /** |
||
130 | * @see ICharge::getIsDiscount() |
||
131 | */ |
||
132 | public function getIsDiscount() |
||
136 | |||
137 | /** |
||
138 | * @see ICharge::setIsDiscount() |
||
139 | * @codeCoverageIgnore |
||
140 | */ |
||
141 | public function setIsDiscount($isDiscount) |
||
142 | { |
||
143 | $this->isDiscount = $isDiscount; |
||
144 | return $this; |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * @see ICharge::getIsPromotion() |
||
149 | */ |
||
150 | public function getIsPromotion() |
||
154 | |||
155 | /** |
||
156 | * @see ICharge::setIsPromotion() |
||
157 | * @codeCoverageIgnore |
||
158 | */ |
||
159 | public function setIsPromotion($isPromotion) |
||
160 | { |
||
161 | $this->isPromotion = $isPromotion; |
||
162 | return $this; |
||
163 | } |
||
164 | |||
165 | /** |
||
166 | * @see ICharge::getInformational() |
||
167 | */ |
||
168 | public function getInformational() |
||
172 | |||
173 | /** |
||
174 | * @see ICharge::setInformational() |
||
175 | * @codeCoverageIgnore |
||
176 | */ |
||
177 | public function setInformational($informational) |
||
178 | { |
||
179 | $this->informational = $informational; |
||
180 | return $this; |
||
181 | } |
||
182 | |||
183 | /** |
||
184 | * @see ICharge::getUnitPrice() |
||
185 | */ |
||
186 | public function getUnitPrice() |
||
190 | |||
191 | /** |
||
192 | * @see ICharge::setUnitPrice() |
||
193 | * @codeCoverageIgnore |
||
194 | */ |
||
195 | public function setUnitPrice($unitPrice) |
||
196 | { |
||
197 | $this->unitPrice = $unitPrice; |
||
198 | return $this; |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * @see ICharge::getLinePrice() |
||
203 | */ |
||
204 | public function getLinePrice() |
||
208 | |||
209 | /** |
||
210 | * @see ICharge::setLinePrice() |
||
211 | * @codeCoverageIgnore |
||
212 | */ |
||
213 | public function setLinePrice($linePrice) |
||
214 | { |
||
215 | $this->linePrice = $linePrice; |
||
216 | return $this; |
||
217 | } |
||
218 | |||
219 | /** |
||
220 | * @see ICharge::getAmount() |
||
221 | */ |
||
222 | public function getAmount() |
||
226 | |||
227 | /** |
||
228 | * @see ICharge::setAmount() |
||
229 | * @codeCoverageIgnore |
||
230 | */ |
||
231 | public function setAmount($amount) |
||
232 | { |
||
233 | $this->amount = $amount; |
||
234 | return $this; |
||
235 | } |
||
236 | |||
237 | /** |
||
238 | * @see TPayload::serializeContents() |
||
239 | */ |
||
240 | protected function serializeContents() |
||
244 | |||
245 | /** |
||
246 | * @see TPayload::getRootNodeName() |
||
247 | */ |
||
248 | protected function getRootNodeName() |
||
252 | |||
253 | /** |
||
254 | * @see TPayload::getXmlNamespace() |
||
255 | */ |
||
256 | protected function getXmlNamespace() |
||
260 | |||
261 | /** |
||
262 | * @see TPayload::getRootAttributes() |
||
263 | */ |
||
264 | protected function getRootAttributes() |
||
265 | { |
||
266 | $name = $this->getName(); |
||
267 | $category = $this->getCategory(); |
||
268 | $isDiscount = $this->getIsDiscount(); |
||
269 | $isPromotion = $this->getIsPromotion(); |
||
270 | $informational = $this->getInformational(); |
||
285 | } |
||
286 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..