1 | <?php |
||
27 | class OrderDetailResponse implements IOrderDetailResponse |
||
28 | { |
||
29 | use TTopLevelPayload; |
||
30 | |||
31 | /** @var string */ |
||
32 | protected $orderType; |
||
33 | /** @var string */ |
||
34 | protected $testType; |
||
35 | /** @var string */ |
||
36 | protected $cancellable; |
||
37 | /** @var IOrderResponse */ |
||
38 | protected $order; |
||
39 | |||
40 | /** |
||
41 | * @param IValidatorIterator |
||
42 | * @param ISchemaValidator |
||
43 | * @param IPayloadMap |
||
44 | * @param LoggerInterface |
||
45 | * @param IPayload |
||
46 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
47 | */ |
||
48 | public function __construct( |
||
49 | IValidatorIterator $validators, |
||
50 | ISchemaValidator $schemaValidator, |
||
51 | IPayloadMap $payloadMap, |
||
52 | LoggerInterface $logger, |
||
53 | IPayload $parentPayload = null |
||
54 | ) { |
||
55 | $this->logger = $logger; |
||
|
|||
56 | $this->validators = $validators; |
||
57 | $this->schemaValidator = $schemaValidator; |
||
58 | $this->parentPayload = $parentPayload; |
||
59 | $this->payloadMap = $payloadMap; |
||
60 | $this->payloadFactory = $this->getNewPayloadFactory(); |
||
61 | |||
62 | $this->initExtractPaths() |
||
63 | ->initOptionalExtractPaths() |
||
64 | ->initSubPayloadExtractPaths() |
||
65 | ->initSubPayloadProperties(); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Initialize the protected class property array self::extractionPaths with xpath |
||
70 | * key/value pairs. |
||
71 | * |
||
72 | * @return self |
||
73 | */ |
||
74 | protected function initExtractPaths() |
||
75 | { |
||
76 | $this->extractionPaths = [ |
||
77 | 'orderType' => 'string(@orderType)', |
||
78 | 'cancellable' => 'string(@cancellable)', |
||
79 | ]; |
||
80 | return $this; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * Initialize the protected class property array self::optionalExtractionPaths with xpath |
||
85 | * key/value pairs. |
||
86 | * |
||
87 | * @return self |
||
88 | */ |
||
89 | protected function initOptionalExtractPaths() |
||
90 | { |
||
91 | $this->optionalExtractionPaths = [ |
||
92 | 'testType' => '@testType', |
||
93 | ]; |
||
94 | return $this; |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * Initialize the protected class property array self::subpayloadExtractionPaths with xpath |
||
99 | * key/value pairs. |
||
100 | * |
||
101 | * @return self |
||
102 | */ |
||
103 | protected function initSubPayloadExtractPaths() |
||
104 | { |
||
105 | $this->subpayloadExtractionPaths = [ |
||
106 | 'order' => 'x:Order', |
||
107 | ]; |
||
108 | return $this; |
||
109 | } |
||
110 | |||
111 | /** |
||
112 | * Initialize any sub-payload class properties with their concrete instance. |
||
113 | * |
||
114 | * @return self |
||
115 | */ |
||
116 | protected function initSubPayloadProperties() |
||
117 | { |
||
118 | $this->setOrder($this->buildPayloadForInterface( |
||
119 | static::ORDER_RESPONSE_INTERFACE |
||
120 | )); |
||
121 | return $this; |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * @see IOrderDetailResponse::getOrderType() |
||
126 | */ |
||
127 | public function getOrderType() |
||
131 | |||
132 | /** |
||
133 | * @see IOrderDetailResponse::setOrderType() |
||
134 | * @codeCoverageIgnore |
||
135 | */ |
||
136 | public function setOrderType($orderType) |
||
137 | { |
||
138 | $this->orderType = $orderType; |
||
139 | return $this; |
||
140 | } |
||
141 | |||
142 | /** |
||
143 | * @see IOrderDetailResponse::getTestType() |
||
144 | */ |
||
145 | public function getTestType() |
||
149 | |||
150 | /** |
||
151 | * @see IOrderDetailResponse::setTestType() |
||
152 | * @codeCoverageIgnore |
||
153 | */ |
||
154 | public function setTestType($testType) |
||
155 | { |
||
156 | $this->testType = $testType; |
||
157 | return $this; |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * @see IOrderDetailResponse::getCancellable() |
||
162 | */ |
||
163 | public function getCancellable() |
||
167 | |||
168 | /** |
||
169 | * @see IOrderDetailResponse::setCancellable() |
||
170 | * @codeCoverageIgnore |
||
171 | */ |
||
172 | public function setCancellable($cancellable) |
||
173 | { |
||
174 | $this->cancellable = $cancellable; |
||
175 | return $this; |
||
176 | } |
||
177 | |||
178 | /** |
||
179 | * @see IOrderDetailResponse::getOrder() |
||
180 | */ |
||
181 | public function getOrder() |
||
185 | |||
186 | /** |
||
187 | * @see IOrderDetailResponse::setOrder() |
||
188 | * @codeCoverageIgnore |
||
189 | */ |
||
190 | public function setOrder(IOrderResponse $order) |
||
191 | { |
||
192 | $this->order = $order; |
||
193 | return $this; |
||
194 | } |
||
195 | |||
196 | /** |
||
197 | * @see TPayload::serializeContents() |
||
198 | */ |
||
199 | protected function serializeContents() |
||
203 | |||
204 | /** |
||
205 | * @see TPayload::getRootNodeName() |
||
206 | */ |
||
207 | protected function getRootNodeName() |
||
211 | |||
212 | /** |
||
213 | * @see TPayload::getXmlNamespace() |
||
214 | */ |
||
215 | protected function getXmlNamespace() |
||
219 | |||
220 | protected function getSchemaFile() |
||
224 | |||
225 | /** |
||
226 | * Validate the serialized data via the schema validator. |
||
227 | * @param string |
||
228 | * @return self |
||
229 | */ |
||
230 | protected function schemaValidate($serializedData) |
||
231 | { |
||
232 | $this->schemaValidator->validate($serializedData, $this->getSchemaFile()); |
||
233 | return $this; |
||
235 | |||
236 | /** |
||
237 | * @see TPayload::getRootAttributes() |
||
238 | */ |
||
239 | protected function getRootAttributes() |
||
248 | } |
||
249 |
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..