1 | <?php |
||
28 | class OrderDetailCustomer implements IOrderDetailCustomer |
||
29 | { |
||
30 | use TPayload, TOrderCustomer; |
||
31 | |||
32 | /** |
||
33 | * @param IValidatorIterator |
||
34 | * @param ISchemaValidator |
||
35 | * @param IPayloadMap |
||
36 | * @param LoggerInterface |
||
37 | * @param IPayload |
||
38 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
39 | */ |
||
40 | public function __construct( |
||
41 | IValidatorIterator $validators, |
||
42 | ISchemaValidator $schemaValidator, |
||
43 | IPayloadMap $payloadMap, |
||
44 | LoggerInterface $logger, |
||
45 | IPayload $parentPayload = null |
||
46 | ) { |
||
47 | $this->logger = $logger; |
||
|
|||
48 | $this->validators = $validators; |
||
49 | $this->schemaValidator = $schemaValidator; |
||
50 | $this->parentPayload = $parentPayload; |
||
51 | $this->payloadMap = $payloadMap; |
||
52 | $this->payloadFactory = $this->getNewPayloadFactory(); |
||
53 | |||
54 | $this->initExtractPaths() |
||
55 | ->initOptionalExtractPaths() |
||
56 | ->initBooleanExtractPaths() |
||
57 | ->initDatetimeExtractPaths() |
||
58 | ->initSubPayloadExtractPaths() |
||
59 | ->initSubPayloadProperties(); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Initialize the protected class property array self::extractionPaths with xpath |
||
64 | * key/value pairs. |
||
65 | * |
||
66 | * @return self |
||
67 | */ |
||
68 | protected function initExtractPaths() |
||
69 | { |
||
70 | $this->extractionPaths = [ |
||
71 | 'firstName' => 'string(x:Name/x:FirstName)', |
||
72 | 'lastName' => 'string(x:Name/x:LastName)', |
||
73 | ]; |
||
74 | return $this; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * Initialize the protected class property array self::optionalExtractionPaths with xpath |
||
79 | * key/value pairs. |
||
80 | * |
||
81 | * @return self |
||
82 | */ |
||
83 | protected function initOptionalExtractPaths() |
||
84 | { |
||
85 | $this->optionalExtractionPaths = [ |
||
86 | 'customerId' => '@customerId', |
||
87 | 'gender' => 'x:Gender', |
||
88 | 'emailAddress' => 'x:EmailAddress', |
||
89 | 'taxId' => 'x:CustomerTaxId', |
||
90 | 'middleName' => 'x:Name/x:MiddleName', |
||
91 | 'honorificName' => 'x:Name/x:Honorific', |
||
92 | ]; |
||
93 | return $this; |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Initialize the protected class property array self::booleanExtractionPaths with xpath |
||
98 | * key/value pairs. |
||
99 | * |
||
100 | * @return self |
||
101 | */ |
||
102 | protected function initBooleanExtractPaths() |
||
103 | { |
||
104 | $this->booleanExtractionPaths = [ |
||
105 | 'taxExempt' => 'string(x:TaxExemptFlag)', |
||
106 | ]; |
||
107 | return $this; |
||
108 | } |
||
109 | |||
110 | /** |
||
111 | * Initialize the protected class property array self::datetimeExtractionPaths with xpath |
||
112 | * key/value pairs. |
||
113 | * |
||
114 | * @return self |
||
115 | */ |
||
116 | protected function initDatetimeExtractPaths() |
||
117 | { |
||
118 | $this->datetimeExtractionPaths = [ |
||
119 | 'dateOfBirth' => 'string(x:DateOfBirth)', |
||
120 | ]; |
||
121 | return $this; |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * Initialize the protected class property array self::subpayloadExtractionPaths with xpath |
||
126 | * key/value pairs. |
||
127 | * |
||
128 | * @return self |
||
129 | */ |
||
130 | protected function initSubPayloadExtractPaths() |
||
131 | { |
||
132 | $this->subpayloadExtractionPaths = [ |
||
133 | 'loyaltyPrograms' => 'x:LoyaltyPrograms', |
||
134 | ]; |
||
135 | return $this; |
||
136 | } |
||
137 | |||
138 | /** |
||
139 | * Initialize any sub-payload class properties with their concrete instance. |
||
140 | * |
||
141 | * @return self |
||
142 | */ |
||
143 | protected function initSubPayloadProperties() |
||
144 | { |
||
145 | $this->setLoyaltyPrograms($this->buildPayloadForInterface( |
||
146 | static::LOYALTY_PROGRAM_ITERABLE_INTERFACE |
||
147 | )); |
||
148 | return $this; |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * @see TPayload::serializeContents() |
||
153 | */ |
||
154 | protected function serializeContents() |
||
158 | |||
159 | /** |
||
160 | * Serialize the order detail customer data into a string of XML. |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | protected function serializeOrderDetailCustomer() |
||
165 | { |
||
166 | return $this->serializePersonName() |
||
167 | . $this->serializeOptionalXmlEncodedValue('Gender', $this->getGender()) |
||
168 | . $this->serializeOptionalDateValue('DateOfBirth', 'Y-m-d', $this->getDateOfBirth()) |
||
169 | . $this->serializeOptionalXmlEncodedValue('EmailAddress', $this->getEmailAddress()) |
||
170 | . $this->serializeOptionalXmlEncodedValue('CustomerTaxId', $this->getTaxId()) |
||
171 | . $this->serializeTaxExemptFlag() |
||
172 | . $this->getLoyaltyPrograms()->serialize(); |
||
173 | } |
||
174 | |||
175 | /** |
||
176 | * @see TPayload::getRootNodeName() |
||
177 | */ |
||
178 | protected function getRootNodeName() |
||
182 | |||
183 | /** |
||
184 | * @see TPayload::getXmlNamespace() |
||
185 | */ |
||
186 | protected function getXmlNamespace() |
||
190 | |||
191 | protected function getPersonNameRootNodeName() |
||
195 | |||
196 | /** |
||
197 | * @see TPayload::getRootAttributes() |
||
198 | */ |
||
199 | protected function getRootAttributes() |
||
200 | { |
||
201 | $customerId = $this->getCustomerId(); |
||
202 | return $customerId ? ['customerId' => $customerId] : []; |
||
203 | } |
||
204 | } |
||
205 |
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..