@@ -119,8 +119,8 @@ |
||
| 119 | 119 | ); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if (isset($atHomeXml->requestedDeliveryDate) && (string)$atHomeXml->requestedDeliveryDate !== '') { |
|
| 123 | - $self->setRequestedDeliveryDate((string)$atHomeXml->requestedDeliveryDate); |
|
| 122 | + if (isset($atHomeXml->requestedDeliveryDate) && (string) $atHomeXml->requestedDeliveryDate !== '') { |
|
| 123 | + $self->setRequestedDeliveryDate((string) $atHomeXml->requestedDeliveryDate); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $self; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | public function setValue(int $value): void |
| 97 | 97 | { |
| 98 | 98 | if (!in_array($value, self::getPossibleValueValues(), true)) { |
| 99 | - throw new BpostInvalidValueException('value', (string)$value, self::getPossibleValueValues()); |
|
| 99 | + throw new BpostInvalidValueException('value', (string) $value, self::getPossibleValueValues()); |
|
| 100 | 100 | } |
| 101 | 101 | $this->value = $value; |
| 102 | 102 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $insured->appendChild($insurance); |
| 119 | 119 | |
| 120 | 120 | if ($this->getValue() !== null) { |
| 121 | - $insurance->setAttribute('value', (string)$this->getValue()); |
|
| 121 | + $insurance->setAttribute('value', (string) $this->getValue()); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | return $insured; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $insuranceDetail = $xml->children('http://schema.post.be/shm/deepintegration/v3/common'); |
| 133 | 133 | $type = $insuranceDetail->getName(); |
| 134 | 134 | $valueAttr = $insuranceDetail->attributes()->value ?? null; |
| 135 | - $value = $valueAttr !== null ? (int)$valueAttr : null; |
|
| 135 | + $value = $valueAttr !== null ? (int) $valueAttr : null; |
|
| 136 | 136 | |
| 137 | 137 | // Compat héritée : additionalInsurance avec value=1 => basicInsurance sans value |
| 138 | 138 | if ($type === static::INSURANCE_TYPE_ADDITIONAL_INSURANCE && $value === 1) { |
@@ -169,13 +169,13 @@ |
||
| 169 | 169 | */ |
| 170 | 170 | public static function createFromXML(SimpleXMLElement $xml): static |
| 171 | 171 | { |
| 172 | - $messaging = new static($xml->getName(), (string)$xml->attributes()->language); |
|
| 172 | + $messaging = new static($xml->getName(), (string) $xml->attributes()->language); |
|
| 173 | 173 | |
| 174 | - if ((string)$xml->emailAddress !== '') { |
|
| 175 | - $messaging->setEmailAddress((string)$xml->emailAddress); |
|
| 174 | + if ((string) $xml->emailAddress !== '') { |
|
| 175 | + $messaging->setEmailAddress((string) $xml->emailAddress); |
|
| 176 | 176 | } |
| 177 | - if ((string)$xml->mobilePhone !== '') { |
|
| 178 | - $messaging->setMobilePhone((string)$xml->mobilePhone); |
|
| 177 | + if ((string) $xml->mobilePhone !== '') { |
|
| 178 | + $messaging->setMobilePhone((string) $xml->mobilePhone); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | return $messaging; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $international->appendChild( |
| 175 | 175 | $document->createElement( |
| 176 | 176 | XmlHelper::getPrefixedTagName('parcelWeight', $innerPrefix), |
| 177 | - (string)$this->parcelWeight |
|
| 177 | + (string) $this->parcelWeight |
|
| 178 | 178 | ) |
| 179 | 179 | ); |
| 180 | 180 | } |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $international = new self(); |
| 205 | 205 | |
| 206 | - if (isset($xml->international->product) && (string)$xml->international->product !== '') { |
|
| 207 | - $international->setProduct((string)$xml->international->product); |
|
| 206 | + if (isset($xml->international->product) && (string) $xml->international->product !== '') { |
|
| 207 | + $international->setProduct((string) $xml->international->product); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (isset($xml->international->options)) { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $option = Messaging::createFromXML($optionData); |
| 219 | 219 | break; |
| 220 | 220 | default: |
| 221 | - $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName()); |
|
| 221 | + $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\'.ucfirst($optionData->getName()); |
|
| 222 | 222 | XmlHelper::assertMethodCreateFromXmlExists($className); |
| 223 | 223 | $option = $className::createFromXML($optionData); |
| 224 | 224 | } |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - if (isset($xml->international->parcelWeight) && (string)$xml->international->parcelWeight !== '') { |
|
| 230 | - $international->setParcelWeight((int)$xml->international->parcelWeight); |
|
| 229 | + if (isset($xml->international->parcelWeight) && (string) $xml->international->parcelWeight !== '') { |
|
| 230 | + $international->setParcelWeight((int) $xml->international->parcelWeight); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | if (isset($xml->international->receiver)) { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function toXML(DOMDocument $document, ?string $prefix = null, ?string $type = null): DOMElement |
| 116 | 116 | { |
| 117 | - $typeElement = $document->createElement((string)$type); |
|
| 117 | + $typeElement = $document->createElement((string) $type); |
|
| 118 | 118 | |
| 119 | 119 | if ($this->product !== null) { |
| 120 | 120 | $typeElement->appendChild( |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | if ($this->weight !== null) { |
| 134 | 134 | $typeElement->appendChild( |
| 135 | - $document->createElement(XmlHelper::getPrefixedTagName('weight', $prefix), (string)$this->weight) |
|
| 135 | + $document->createElement(XmlHelper::getPrefixedTagName('weight', $prefix), (string) $this->weight) |
|
| 136 | 136 | ); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | throw new BpostException('Set an instance of National'); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if (isset($nationalXml->product) && (string)$nationalXml->product !== '') { |
|
| 172 | - $self->setProduct((string)$nationalXml->product); |
|
| 171 | + if (isset($nationalXml->product) && (string) $nationalXml->product !== '') { |
|
| 172 | + $self->setProduct((string) $nationalXml->product); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (isset($nationalXml->options) && !empty($nationalXml->options)) { |
@@ -195,18 +195,18 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - if (isset($nationalXml->weight) && (string)$nationalXml->weight !== '') { |
|
| 199 | - $self->setWeight((int)$nationalXml->weight); |
|
| 198 | + if (isset($nationalXml->weight) && (string) $nationalXml->weight !== '') { |
|
| 199 | + $self->setWeight((int) $nationalXml->weight); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if (isset($nationalXml->openingHours) && (string)$nationalXml->openingHours !== '') { |
|
| 202 | + if (isset($nationalXml->openingHours) && (string) $nationalXml->openingHours !== '') { |
|
| 203 | 203 | foreach ($nationalXml->openingHours->children() as $day => $value) { |
| 204 | - $self->addOpeningHour(new Day((string)$day, (string)$value)); |
|
| 204 | + $self->addOpeningHour(new Day((string) $day, (string) $value)); |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if (isset($nationalXml->desiredDeliveryPlace) && (string)$nationalXml->desiredDeliveryPlace !== '') { |
|
| 209 | - $self->setDesiredDeliveryPlace((string)$nationalXml->desiredDeliveryPlace); |
|
| 208 | + if (isset($nationalXml->desiredDeliveryPlace) && (string) $nationalXml->desiredDeliveryPlace !== '') { |
|
| 209 | + $self->setDesiredDeliveryPlace((string) $nationalXml->desiredDeliveryPlace); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | return $self; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | protected static function getOptionFromOptionData(SimpleXMLElement $optionData): Option |
| 219 | 219 | { |
| 220 | - $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName()); |
|
| 220 | + $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\'.ucfirst($optionData->getName()); |
|
| 221 | 221 | XmlHelper::assertMethodCreateFromXmlExists($className); |
| 222 | 222 | |
| 223 | 223 | /** @var callable $factory */ |
@@ -106,16 +106,16 @@ |
||
| 106 | 106 | { |
| 107 | 107 | $self = new self(); |
| 108 | 108 | |
| 109 | - if (isset($xml->language) && (string)$xml->language !== '') { |
|
| 110 | - $self->setLanguage((string)$xml->language); |
|
| 109 | + if (isset($xml->language) && (string) $xml->language !== '') { |
|
| 110 | + $self->setLanguage((string) $xml->language); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if (isset($xml->mobilePhone) && (string)$xml->mobilePhone !== '') { |
|
| 114 | - $self->setMobilePhone((string)$xml->mobilePhone); |
|
| 113 | + if (isset($xml->mobilePhone) && (string) $xml->mobilePhone !== '') { |
|
| 114 | + $self->setMobilePhone((string) $xml->mobilePhone); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if (isset($xml->emailAddress) && (string)$xml->emailAddress !== '') { |
|
| 118 | - $self->setEmailAddress((string)$xml->emailAddress); |
|
| 117 | + if (isset($xml->emailAddress) && (string) $xml->emailAddress !== '') { |
|
| 118 | + $self->setEmailAddress((string) $xml->emailAddress); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | if (isset($xml->parcelLockerReducedMobilityZone)) { |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $atBpost = new AtBpost(); |
| 188 | 188 | |
| 189 | - if (isset($xml->atBpost->product) && (string)$xml->atBpost->product !== '') { |
|
| 190 | - $atBpost->setProduct((string)$xml->atBpost->product); |
|
| 189 | + if (isset($xml->atBpost->product) && (string) $xml->atBpost->product !== '') { |
|
| 190 | + $atBpost->setProduct((string) $xml->atBpost->product); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (isset($xml->atBpost->options)) { |
@@ -213,31 +213,31 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if (isset($xml->atBpost->weight) && (string)$xml->atBpost->weight !== '') { |
|
| 217 | - $atBpost->setWeight((int)$xml->atBpost->weight); |
|
| 216 | + if (isset($xml->atBpost->weight) && (string) $xml->atBpost->weight !== '') { |
|
| 217 | + $atBpost->setWeight((int) $xml->atBpost->weight); |
|
| 218 | 218 | } |
| 219 | - if (isset($xml->atBpost->receiverName) && (string)$xml->atBpost->receiverName !== '') { |
|
| 220 | - $atBpost->setReceiverName((string)$xml->atBpost->receiverName); |
|
| 219 | + if (isset($xml->atBpost->receiverName) && (string) $xml->atBpost->receiverName !== '') { |
|
| 220 | + $atBpost->setReceiverName((string) $xml->atBpost->receiverName); |
|
| 221 | 221 | } |
| 222 | - if (isset($xml->atBpost->receiverCompany) && (string)$xml->atBpost->receiverCompany !== '') { |
|
| 223 | - $atBpost->setReceiverCompany((string)$xml->atBpost->receiverCompany); |
|
| 222 | + if (isset($xml->atBpost->receiverCompany) && (string) $xml->atBpost->receiverCompany !== '') { |
|
| 223 | + $atBpost->setReceiverCompany((string) $xml->atBpost->receiverCompany); |
|
| 224 | 224 | } |
| 225 | - if (isset($xml->atBpost->pugoId) && (string)$xml->atBpost->pugoId !== '') { |
|
| 226 | - $atBpost->setPugoId((string)$xml->atBpost->pugoId); |
|
| 225 | + if (isset($xml->atBpost->pugoId) && (string) $xml->atBpost->pugoId !== '') { |
|
| 226 | + $atBpost->setPugoId((string) $xml->atBpost->pugoId); |
|
| 227 | 227 | } |
| 228 | - if (isset($xml->atBpost->pugoName) && (string)$xml->atBpost->pugoName !== '') { |
|
| 229 | - $atBpost->setPugoName((string)$xml->atBpost->pugoName); |
|
| 228 | + if (isset($xml->atBpost->pugoName) && (string) $xml->atBpost->pugoName !== '') { |
|
| 229 | + $atBpost->setPugoName((string) $xml->atBpost->pugoName); |
|
| 230 | 230 | } |
| 231 | 231 | if (isset($xml->atBpost->pugoAddress)) { |
| 232 | 232 | $pugoAddressData = $xml->atBpost->pugoAddress |
| 233 | 233 | ->children('http://schema.post.be/shm/deepintegration/v3/common'); |
| 234 | 234 | $atBpost->setPugoAddress(PugoAddress::createFromXML($pugoAddressData)); |
| 235 | 235 | } |
| 236 | - if (isset($xml->atBpost->requestedDeliveryDate) && (string)$xml->atBpost->requestedDeliveryDate !== '') { |
|
| 237 | - $atBpost->setRequestedDeliveryDate((string)$xml->atBpost->requestedDeliveryDate); |
|
| 236 | + if (isset($xml->atBpost->requestedDeliveryDate) && (string) $xml->atBpost->requestedDeliveryDate !== '') { |
|
| 237 | + $atBpost->setRequestedDeliveryDate((string) $xml->atBpost->requestedDeliveryDate); |
|
| 238 | 238 | } |
| 239 | - if (isset($xml->atBpost->shopHandlingInstruction) && (string)$xml->atBpost->shopHandlingInstruction !== '') { |
|
| 240 | - $atBpost->setShopHandlingInstruction((string)$xml->atBpost->shopHandlingInstruction); |
|
| 239 | + if (isset($xml->atBpost->shopHandlingInstruction) && (string) $xml->atBpost->shopHandlingInstruction !== '') { |
|
| 240 | + $atBpost->setShopHandlingInstruction((string) $xml->atBpost->shopHandlingInstruction); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | return $atBpost; |
@@ -244,26 +244,26 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | $customsInfo = new self(); |
| 246 | 246 | |
| 247 | - if (isset($xml->parcelValue) && (string)$xml->parcelValue !== '') { |
|
| 248 | - $customsInfo->setParcelValue((int)$xml->parcelValue); |
|
| 247 | + if (isset($xml->parcelValue) && (string) $xml->parcelValue !== '') { |
|
| 248 | + $customsInfo->setParcelValue((int) $xml->parcelValue); |
|
| 249 | 249 | } |
| 250 | - if (isset($xml->contentDescription) && (string)$xml->contentDescription !== '') { |
|
| 251 | - $customsInfo->setContentDescription((string)$xml->contentDescription); |
|
| 250 | + if (isset($xml->contentDescription) && (string) $xml->contentDescription !== '') { |
|
| 251 | + $customsInfo->setContentDescription((string) $xml->contentDescription); |
|
| 252 | 252 | } |
| 253 | - if (isset($xml->shipmentType) && (string)$xml->shipmentType !== '') { |
|
| 254 | - $customsInfo->setShipmentType((string)$xml->shipmentType); |
|
| 253 | + if (isset($xml->shipmentType) && (string) $xml->shipmentType !== '') { |
|
| 254 | + $customsInfo->setShipmentType((string) $xml->shipmentType); |
|
| 255 | 255 | } |
| 256 | - if (isset($xml->parcelReturnInstructions) && (string)$xml->parcelReturnInstructions !== '') { |
|
| 257 | - $customsInfo->setParcelReturnInstructions((string)$xml->parcelReturnInstructions); |
|
| 256 | + if (isset($xml->parcelReturnInstructions) && (string) $xml->parcelReturnInstructions !== '') { |
|
| 257 | + $customsInfo->setParcelReturnInstructions((string) $xml->parcelReturnInstructions); |
|
| 258 | 258 | } |
| 259 | - if (isset($xml->privateAddress) && (string)$xml->privateAddress !== '') { |
|
| 260 | - $customsInfo->setPrivateAddress(in_array((string)$xml->privateAddress, ['true', '1'], true)); |
|
| 259 | + if (isset($xml->privateAddress) && (string) $xml->privateAddress !== '') { |
|
| 260 | + $customsInfo->setPrivateAddress(in_array((string) $xml->privateAddress, ['true', '1'], true)); |
|
| 261 | 261 | } |
| 262 | - if (isset($xml->currency) && (string)$xml->currency !== '') { |
|
| 263 | - $customsInfo->setCurrency((string)$xml->currency); |
|
| 262 | + if (isset($xml->currency) && (string) $xml->currency !== '') { |
|
| 263 | + $customsInfo->setCurrency((string) $xml->currency); |
|
| 264 | 264 | } |
| 265 | - if (isset($xml->amtPostagePaidByAddresse) && (string)$xml->amtPostagePaidByAddresse !== '') { |
|
| 266 | - $customsInfo->setAmtPostagePaidByAddresse((float)$xml->amtPostagePaidByAddresse); |
|
| 265 | + if (isset($xml->amtPostagePaidByAddresse) && (string) $xml->amtPostagePaidByAddresse !== '') { |
|
| 266 | + $customsInfo->setAmtPostagePaidByAddresse((float) $xml->amtPostagePaidByAddresse); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | return $customsInfo; |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $customsInfo->appendChild( |
| 277 | 277 | $document->createElement( |
| 278 | 278 | XmlHelper::getPrefixedTagName('parcelValue', $prefix), |
| 279 | - (string)$this->getParcelValue() |
|
| 279 | + (string) $this->getParcelValue() |
|
| 280 | 280 | ) |
| 281 | 281 | ); |
| 282 | 282 | } |
@@ -90,8 +90,8 @@ |
||
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (isset($bpostOnAppointmentXml->inNetworkCutOff) && (string)$bpostOnAppointmentXml->inNetworkCutOff !== '') { |
|
| 94 | - $self->setInNetworkCutOff((string)$bpostOnAppointmentXml->inNetworkCutOff); |
|
| 93 | + if (isset($bpostOnAppointmentXml->inNetworkCutOff) && (string) $bpostOnAppointmentXml->inNetworkCutOff !== '') { |
|
| 94 | + $self->setInNetworkCutOff((string) $bpostOnAppointmentXml->inNetworkCutOff); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return $self; |